From 339491a6b37722497ebafe9998e17507f47e8fd6 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Wed, 25 Jun 2008 15:24:12 -0500 Subject: Set precompiled fixture load path constant to speed up tests --- ...nder_partial_with_record_identification_test.rb | 26 ++++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'actionpack/test/activerecord/render_partial_with_record_identification_test.rb') diff --git a/actionpack/test/activerecord/render_partial_with_record_identification_test.rb b/actionpack/test/activerecord/render_partial_with_record_identification_test.rb index ed10e72953..af2725a99b 100644 --- a/actionpack/test/activerecord/render_partial_with_record_identification_test.rb +++ b/actionpack/test/activerecord/render_partial_with_record_identification_test.rb @@ -40,11 +40,12 @@ class RenderPartialWithRecordIdentificationController < ActionController::Base render :partial => @developers end end -RenderPartialWithRecordIdentificationController.view_paths = [ File.dirname(__FILE__) + "/../fixtures/" ] + +RenderPartialWithRecordIdentificationController.view_paths = [FIXTURE_LOAD_PATH] class RenderPartialWithRecordIdentificationTest < ActiveRecordTestCase fixtures :developers, :projects, :developers_projects, :topics, :replies, :companies, :mascots - + def setup @controller = RenderPartialWithRecordIdentificationController.new @request = ActionController::TestRequest.new @@ -56,22 +57,22 @@ class RenderPartialWithRecordIdentificationTest < ActiveRecordTestCase get :render_with_has_many_and_belongs_to_association assert_template 'projects/_project' end - + def test_rendering_partial_with_has_many_association get :render_with_has_many_association assert_template 'replies/_reply' end - + def test_rendering_partial_with_named_scope get :render_with_named_scope assert_template 'replies/_reply' end - + def test_render_with_record get :render_with_record assert_template 'developers/_developer' end - + def test_render_with_record_collection get :render_with_record_collection assert_template 'developers/_developer' @@ -116,7 +117,8 @@ class RenderPartialWithRecordIdentificationController < ActionController::Base render :partial => @developers end end -RenderPartialWithRecordIdentificationController.view_paths = [ File.dirname(__FILE__) + "/../fixtures/" ] + +RenderPartialWithRecordIdentificationController.view_paths = [FIXTURE_LOAD_PATH] class Game < Struct.new(:name, :id) def to_param @@ -134,7 +136,8 @@ module Fun render :partial => [ Game.new("Pong"), Game.new("Tank") ] end end - NestedController.view_paths = [ File.dirname(__FILE__) + "/../fixtures/" ] + + NestedController.view_paths = [FIXTURE_LOAD_PATH] module Serious class NestedDeeperController < ActionController::Base @@ -146,7 +149,8 @@ module Fun render :partial => [ Game.new("Chess"), Game.new("Sudoku"), Game.new("Solitaire") ] end end - NestedDeeperController.view_paths = [ File.dirname(__FILE__) + "/../fixtures/" ] + + NestedDeeperController.view_paths = [FIXTURE_LOAD_PATH] end end @@ -167,7 +171,6 @@ class RenderPartialWithRecordIdentificationAndNestedControllersTest < ActiveReco get :render_with_record_collection_in_nested_controller assert_template 'fun/games/_game' end - end class RenderPartialWithRecordIdentificationAndNestedDeeperControllersTest < ActiveRecordTestCase @@ -187,5 +190,4 @@ class RenderPartialWithRecordIdentificationAndNestedDeeperControllersTest < Acti get :render_with_record_collection_in_deeper_nested_controller assert_template 'fun/serious/games/_game' end - -end \ No newline at end of file +end -- cgit v1.2.3 From b603de08825eec05f1b97d0f5d71462f3fa4c222 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sat, 12 Jul 2008 12:15:31 -0500 Subject: Improve test coverage and create fixtures for RenderPartialWithRecordIdentificationTests --- .../render_partial_with_record_identification_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'actionpack/test/activerecord/render_partial_with_record_identification_test.rb') diff --git a/actionpack/test/activerecord/render_partial_with_record_identification_test.rb b/actionpack/test/activerecord/render_partial_with_record_identification_test.rb index af2725a99b..a9d3ff040f 100644 --- a/actionpack/test/activerecord/render_partial_with_record_identification_test.rb +++ b/actionpack/test/activerecord/render_partial_with_record_identification_test.rb @@ -56,26 +56,31 @@ class RenderPartialWithRecordIdentificationTest < ActiveRecordTestCase def test_rendering_partial_with_has_many_and_belongs_to_association get :render_with_has_many_and_belongs_to_association assert_template 'projects/_project' + assert_equal 'Active RecordActive Controller', @response.body end def test_rendering_partial_with_has_many_association get :render_with_has_many_association assert_template 'replies/_reply' + assert_equal 'Birdman is better!', @response.body end def test_rendering_partial_with_named_scope get :render_with_named_scope assert_template 'replies/_reply' + assert_equal 'Birdman is better!Nuh uh!', @response.body end def test_render_with_record get :render_with_record assert_template 'developers/_developer' + assert_equal 'David', @response.body end def test_render_with_record_collection get :render_with_record_collection assert_template 'developers/_developer' + assert_equal 'DavidJamisfixture_3fixture_4fixture_5fixture_6fixture_7fixture_8fixture_9fixture_10Jamis', @response.body end def test_rendering_partial_with_has_one_association @@ -165,11 +170,13 @@ class RenderPartialWithRecordIdentificationAndNestedControllersTest < ActiveReco def test_render_with_record_in_nested_controller get :render_with_record_in_nested_controller assert_template 'fun/games/_game' + assert_equal 'Pong', @response.body end def test_render_with_record_collection_in_nested_controller get :render_with_record_collection_in_nested_controller assert_template 'fun/games/_game' + assert_equal 'PongTank', @response.body end end @@ -184,10 +191,12 @@ class RenderPartialWithRecordIdentificationAndNestedDeeperControllersTest < Acti def test_render_with_record_in_deeper_nested_controller get :render_with_record_in_deeper_nested_controller assert_template 'fun/serious/games/_game' + assert_equal 'Chess', @response.body 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' + assert_equal 'ChessSudokuSolitaire', @response.body end end -- cgit v1.2.3 From 30204c4e66cea989c4ee48b52c8827c79e98f14a Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sat, 12 Jul 2008 14:11:51 -0500 Subject: Set global ActionController::Base.view_paths for test cases --- .../render_partial_with_record_identification_test.rb | 8 -------- 1 file changed, 8 deletions(-) (limited to 'actionpack/test/activerecord/render_partial_with_record_identification_test.rb') diff --git a/actionpack/test/activerecord/render_partial_with_record_identification_test.rb b/actionpack/test/activerecord/render_partial_with_record_identification_test.rb index a9d3ff040f..a82a1a3023 100644 --- a/actionpack/test/activerecord/render_partial_with_record_identification_test.rb +++ b/actionpack/test/activerecord/render_partial_with_record_identification_test.rb @@ -41,8 +41,6 @@ class RenderPartialWithRecordIdentificationController < ActionController::Base end end -RenderPartialWithRecordIdentificationController.view_paths = [FIXTURE_LOAD_PATH] - class RenderPartialWithRecordIdentificationTest < ActiveRecordTestCase fixtures :developers, :projects, :developers_projects, :topics, :replies, :companies, :mascots @@ -123,8 +121,6 @@ class RenderPartialWithRecordIdentificationController < ActionController::Base end end -RenderPartialWithRecordIdentificationController.view_paths = [FIXTURE_LOAD_PATH] - class Game < Struct.new(:name, :id) def to_param id.to_s @@ -142,8 +138,6 @@ module Fun end end - NestedController.view_paths = [FIXTURE_LOAD_PATH] - module Serious class NestedDeeperController < ActionController::Base def render_with_record_in_deeper_nested_controller @@ -154,8 +148,6 @@ module Fun render :partial => [ Game.new("Chess"), Game.new("Sudoku"), Game.new("Solitaire") ] end end - - NestedDeeperController.view_paths = [FIXTURE_LOAD_PATH] end end -- cgit v1.2.3