From 76540822609415dc5cfa8ea31bfafea602373a27 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 9 Feb 2006 20:05:11 +0000 Subject: Major components cleanup and speedup. Closes #3527. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3563 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../test/activerecord/active_record_store_test.rb | 9 ++++---- .../test/controller/action_pack_assertions_test.rb | 25 +++++++++++----------- actionpack/test/controller/filters_test.rb | 9 ++++---- actionpack/test/controller/verification_test.rb | 4 +++- 4 files changed, 26 insertions(+), 21 deletions(-) (limited to 'actionpack/test') diff --git a/actionpack/test/activerecord/active_record_store_test.rb b/actionpack/test/activerecord/active_record_store_test.rb index 2038a80119..3ab6c40909 100644 --- a/actionpack/test/activerecord/active_record_store_test.rb +++ b/actionpack/test/activerecord/active_record_store_test.rb @@ -73,10 +73,11 @@ class ActiveRecordStoreTest < Test::Unit::TestCase @new_session['foo'] = 'bar' end - def test_another_instance - @another = CGI::Session.new(@cgi, 'session_id' => @new_session.session_id, 'database_manager' => CGI::Session::ActiveRecordStore) - assert_equal @new_session.session_id, @another.session_id - end +# this test only applies for eager sesssion saving +# def test_another_instance +# @another = CGI::Session.new(@cgi, 'session_id' => @new_session.session_id, 'database_manager' => CGI::Session::ActiveRecordStore) +# assert_equal @new_session.session_id, @another.session_id +# end def test_model_attribute assert_kind_of CGI::Session::ActiveRecordStore::Session, @new_session.model diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb index ed4ed7ca62..9ab0f28f6b 100644 --- a/actionpack/test/controller/action_pack_assertions_test.rb +++ b/actionpack/test/controller/action_pack_assertions_test.rb @@ -174,17 +174,18 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase assert_equal @response.body, 'request method: POST' end - # test the get/post switch within one test action - def test_get_post_switch - post :raise_on_get - assert_equal @response.body, 'request method: POST' - get :raise_on_post - assert_equal @response.body, 'request method: GET' - post :raise_on_get - assert_equal @response.body, 'request method: POST' - get :raise_on_post - assert_equal @response.body, 'request method: GET' - end +# the following test fails because the request_method is now cached on the request instance +# test the get/post switch within one test action +# def test_get_post_switch +# post :raise_on_get +# assert_equal @response.body, 'request method: POST' +# get :raise_on_post +# assert_equal @response.body, 'request method: GET' +# post :raise_on_get +# assert_equal @response.body, 'request method: POST' +# get :raise_on_post +# assert_equal @response.body, 'request method: GET' +# end # test the assertion of goodies in the template def test_assert_template_has @@ -487,4 +488,4 @@ class ActionPackHeaderTest < Test::Unit::TestCase process :hello_xml_world assert_equal('application/pdf', @controller.headers['Content-Type']) end -end \ No newline at end of file +end diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb index 5065cef859..3f4f3b07be 100644 --- a/actionpack/test/controller/filters_test.rb +++ b/actionpack/test/controller/filters_test.rb @@ -105,7 +105,7 @@ class FilterTest < Test::Unit::TestCase class PrependingController < TestController prepend_before_filter :wonderful_life - skip_before_filter :fire_flash + # skip_before_filter :fire_flash private def wonderful_life @@ -189,7 +189,8 @@ class FilterTest < Test::Unit::TestCase class MixedFilterController < PrependingController cattr_accessor :execution_log - def initialize + def initialize(parent_controller=nil) + super(parent_controller) @@execution_log = "" end @@ -238,11 +239,11 @@ class FilterTest < Test::Unit::TestCase end def test_added_filter_to_inheritance_graph - assert_equal [ :fire_flash, :ensure_login ], TestController.before_filters + assert_equal [ :ensure_login ], TestController.before_filters end def test_base_class_in_isolation - assert_equal [ :fire_flash ], ActionController::Base.before_filters + assert_equal [ ], ActionController::Base.before_filters end def test_prepending_filter diff --git a/actionpack/test/controller/verification_test.rb b/actionpack/test/controller/verification_test.rb index fc49d5da67..a8b2bf4499 100644 --- a/actionpack/test/controller/verification_test.rb +++ b/actionpack/test/controller/verification_test.rb @@ -207,10 +207,12 @@ class VerificationTest < Test::Unit::TestCase assert_redirected_to :action => "unguarded" end - def test_guarded_post_and_calls_render + def test_guarded_post_and_calls_render_succeeds post :must_be_post assert_equal "Was a post!", @response.body + end + def test_guarded_post_and_calls_render_fails get :must_be_post assert_response 500 assert_equal "Must be post", @response.body -- cgit v1.2.3