diff options
-rw-r--r-- | actionpack/test/controller/filters_test.rb | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb index bdec5d2d4c..9e74538310 100644 --- a/actionpack/test/controller/filters_test.rb +++ b/actionpack/test/controller/filters_test.rb @@ -2,6 +2,8 @@ require 'abstract_unit' # FIXME: crashes Ruby 1.9 class FilterTest < Test::Unit::TestCase + include ActionController::TestProcess + class TestController < ActionController::Base before_filter :ensure_login after_filter :clean_up @@ -669,12 +671,11 @@ class FilterTest < Test::Unit::TestCase private def test_process(controller, action = "show") - ActionController::Base.class_eval { include ActionController::ProcessWithTest } unless ActionController::Base < ActionController::ProcessWithTest - request = ActionController::TestRequest.new - request.action = action - controller = controller.new if controller.is_a?(Class) - @controller = controller - @controller.process(request, ActionController::TestResponse.new) + @controller = controller.is_a?(Class) ? controller.new : controller + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + + process(action) end end @@ -810,6 +811,7 @@ end class YieldingAroundFiltersTest < Test::Unit::TestCase include PostsController::AroundExceptions + include ActionController::TestProcess def test_filters_registering assert_equal 1, ControllerWithFilterMethod.filter_chain.size @@ -912,11 +914,10 @@ class YieldingAroundFiltersTest < Test::Unit::TestCase protected def test_process(controller, action = "show") - ActionController::Base.class_eval { include ActionController::ProcessWithTest } unless ActionController::Base < ActionController::ProcessWithTest - request = ActionController::TestRequest.new - request.action = action - controller = controller.new if controller.is_a?(Class) - @controller = controller - @controller.process(request, ActionController::TestResponse.new) + @controller = controller.is_a?(Class) ? controller.new : controller + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + + process(action) end end |