Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update some old tests to use AC TestProcess

  • Loading branch information...
commit 664ae187a927ba54c8c7ec6eaf9ad89be291fc95 1 parent 05bd863
Joshua Peek josh authored
Showing with 13 additions and 12 deletions.
  1. +13 −12 actionpack/test/controller/filters_test.rb
25 actionpack/test/controller/filters_test.rb
View
@@ -2,6 +2,8 @@
# 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 @@ def test_a_rescuing_around_filter
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 @@ class ControllerWithTwoLessFilters < ControllerWithAllTypesOfFilters
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 @@ def test_last_filter_in_multiple_before_filter_chain_halts
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
Please sign in to comment.
Something went wrong with that request. Please try again.