Upgraded to Rails 2.1. This can have wide ranging consequences, so please help track down any issues introduced by the upgrade. Requires environment.rb modifications.

Changes you will need to make:

 * In your environment.rb, you will need to update references to a few files per environment.rb.tmpl
 * In your environment.rb, you will need to specify the local time zone of the computer that is running your Tracks install.

Other notes on my changes:

 * Modified our code to take advantage of Rails 2.1's slick time zone support.
 * Upgraded will_paginate for compatibility
 * Hacked the Selenium on Rails plugin, which has not been updated in some time and does not support Rails 2.1
 * Verified that all tests pass on my machine, including Selenium tests -- I'd like confirmation from others, too.
This commit is contained in:
Luke Melia 2008-06-17 01:13:25 -04:00
parent f3bae73868
commit 901a58f8a3
1086 changed files with 51452 additions and 19526 deletions

View file

@ -1,9 +1,8 @@
# These tests exercise CGI::Session::ActiveRecordStore, so you're going to
# need AR in a sibling directory to AP and have SQLite installed.
require File.dirname(__FILE__) + '/../active_record_unit'
require 'active_record_unit'
require 'action_controller/session/active_record_store'
module CommonActiveRecordStoreTests
def test_basics
s = session_class.new(:session_id => '1234', :data => { 'foo' => 'bar' })
@ -66,7 +65,7 @@ class ActiveRecordStoreTest < ActiveRecordTestCase
def test_save_unloaded_session
c = session_class.connection
bogus_class = c.quote(Base64.encode64("\004\010o:\vBlammo\000"))
bogus_class = c.quote(ActiveSupport::Base64.encode64("\004\010o:\vBlammo\000"))
c.insert("INSERT INTO #{session_class.table_name} ('#{session_id_column}', 'data') VALUES ('abcdefghijklmnop', #{bogus_class})")
sess = session_class.find_by_session_id('abcdefghijklmnop')

View file

@ -1,39 +1,49 @@
require File.dirname(__FILE__) + '/../active_record_unit'
require 'active_record_unit'
class RenderPartialWithRecordIdentificationController < ActionController::Base
def render_with_has_many_and_belongs_to_association
@developer = Developer.find(1)
render :partial => @developer.projects
end
def render_with_has_many_association
@topic = Topic.find(1)
render :partial => @topic.replies
end
def render_with_named_scope
render :partial => Reply.base
end
def render_with_has_many_through_association
@developer = Developer.find(:first)
render :partial => @developer.topics
end
def render_with_has_one_association
@company = Company.find(1)
render :partial => @company.mascot
end
def render_with_belongs_to_association
@reply = Reply.find(1)
render :partial => @reply.topic
end
def render_with_record
@developer = Developer.find(:first)
render :partial => @developer
end
def render_with_record_collection
@developers = Developer.find(:all)
render :partial => @developers
end
end
RenderPartialWithRecordIdentificationController.view_paths = [ File.dirname(__FILE__) + "/../fixtures/" ]
class RenderPartialWithRecordIdentificationTest < ActiveRecordTestCase
fixtures :developers, :projects, :developers_projects, :topics, :replies
class RenderPartialWithRecordIdentificationController < ActionController::Base
def render_with_has_many_and_belongs_to_association
@developer = Developer.find(1)
render :partial => @developer.projects
end
def render_with_has_many_association
@topic = Topic.find(1)
render :partial => @topic.replies
end
def render_with_has_many_through_association
@developer = Developer.find(:first)
render :partial => @developer.topics
end
def render_with_belongs_to_association
@reply = Reply.find(1)
render :partial => @reply.topic
end
def render_with_record
@developer = Developer.find(:first)
render :partial => @developer
end
def render_with_record_collection
@developers = Developer.find(:all)
render :partial => @developers
end
end
fixtures :developers, :projects, :developers_projects, :topics, :replies, :companies, :mascots
def setup
@controller = RenderPartialWithRecordIdentificationController.new
@ -52,14 +62,9 @@ class RenderPartialWithRecordIdentificationTest < ActiveRecordTestCase
assert_template 'replies/_reply'
end
def test_rendering_partial_with_has_many_association
get :render_with_has_many_through_association
assert_template 'topics/_topic'
end
def test_rendering_partial_with_belongs_to_association
get :render_with_belongs_to_association
assert_template 'topics/_topic'
def test_rendering_partial_with_named_scope
get :render_with_named_scope
assert_template 'replies/_reply'
end
def test_render_with_record
@ -71,4 +76,116 @@ class RenderPartialWithRecordIdentificationTest < ActiveRecordTestCase
get :render_with_record_collection
assert_template 'developers/_developer'
end
def test_rendering_partial_with_has_one_association
mascot = Company.find(1).mascot
get :render_with_has_one_association
assert_template 'mascots/_mascot'
assert_equal mascot.name, @response.body
end
end
class RenderPartialWithRecordIdentificationController < ActionController::Base
def render_with_has_many_and_belongs_to_association
@developer = Developer.find(1)
render :partial => @developer.projects
end
def render_with_has_many_association
@topic = Topic.find(1)
render :partial => @topic.replies
end
def render_with_has_many_through_association
@developer = Developer.find(:first)
render :partial => @developer.topics
end
def render_with_belongs_to_association
@reply = Reply.find(1)
render :partial => @reply.topic
end
def render_with_record
@developer = Developer.find(:first)
render :partial => @developer
end
def render_with_record_collection
@developers = Developer.find(:all)
render :partial => @developers
end
end
RenderPartialWithRecordIdentificationController.view_paths = [ File.dirname(__FILE__) + "/../fixtures/" ]
class Game < Struct.new(:name, :id)
def to_param
id.to_s
end
end
module Fun
class NestedController < ActionController::Base
def render_with_record_in_nested_controller
render :partial => Game.new("Pong")
end
def render_with_record_collection_in_nested_controller
render :partial => [ Game.new("Pong"), Game.new("Tank") ]
end
end
NestedController.view_paths = [ File.dirname(__FILE__) + "/../fixtures/" ]
module Serious
class NestedDeeperController < ActionController::Base
def render_with_record_in_deeper_nested_controller
render :partial => Game.new("Chess")
end
def render_with_record_collection_in_deeper_nested_controller
render :partial => [ Game.new("Chess"), Game.new("Sudoku"), Game.new("Solitaire") ]
end
end
NestedDeeperController.view_paths = [ File.dirname(__FILE__) + "/../fixtures/" ]
end
end
class RenderPartialWithRecordIdentificationAndNestedControllersTest < ActiveRecordTestCase
def setup
@controller = Fun::NestedController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
super
end
def test_render_with_record_in_nested_controller
get :render_with_record_in_nested_controller
assert_template 'fun/games/_game'
end
def test_render_with_record_collection_in_nested_controller
get :render_with_record_collection_in_nested_controller
assert_template 'fun/games/_game'
end
end
class RenderPartialWithRecordIdentificationAndNestedDeeperControllersTest < ActiveRecordTestCase
def setup
@controller = Fun::Serious::NestedDeeperController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
super
end
def test_render_with_record_in_deeper_nested_controller
get :render_with_record_in_deeper_nested_controller
assert_template 'fun/serious/games/_game'
end
def test_render_with_record_collection_in_deeper_nested_controller
get :render_with_record_collection_in_deeper_nested_controller
assert_template 'fun/serious/games/_game'
end
end