aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/filters_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/controller/filters_test.rb')
-rw-r--r--actionpack/test/controller/filters_test.rb32
1 files changed, 30 insertions, 2 deletions
diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb
index 046396b37c..afc00a3c9d 100644
--- a/actionpack/test/controller/filters_test.rb
+++ b/actionpack/test/controller/filters_test.rb
@@ -326,6 +326,12 @@ class FilterTest < ActionController::TestCase
controller.instance_variable_set(:"@after_ran", true)
controller.class.execution_log << " after aroundfilter " if controller.respond_to? :execution_log
end
+
+ def around(controller)
+ before(controller)
+ yield
+ after(controller)
+ end
end
class AppendedAroundFilter
@@ -336,6 +342,12 @@ class FilterTest < ActionController::TestCase
def after(controller)
controller.class.execution_log << " after appended aroundfilter "
end
+
+ def around(controller)
+ before(controller)
+ yield
+ after(controller)
+ end
end
class AuditController < ActionController::Base
@@ -493,6 +505,10 @@ class FilterTest < ActionController::TestCase
def show
render :text => 'hello world'
end
+
+ def error
+ raise StandardError.new
+ end
end
class ImplicitActionsController < ActionController::Base
@@ -510,11 +526,25 @@ class FilterTest < ActionController::TestCase
end
end
+ def test_sweeper_should_not_ignore_no_method_error
+ sweeper = ActionController::Caching::Sweeper.send(:new)
+ assert_raise NoMethodError do
+ sweeper.send_not_defined
+ end
+ end
+
def test_sweeper_should_not_block_rendering
response = test_process(SweeperTestController)
assert_equal 'hello world', response.body
end
+ def test_sweeper_should_clean_up_if_exception_is_raised
+ assert_raise StandardError do
+ test_process(SweeperTestController, 'error')
+ end
+ assert_nil AppSweeper.instance.controller
+ end
+
def test_before_method_of_sweeper_should_always_return_true
sweeper = ActionController::Caching::Sweeper.send(:new)
assert sweeper.before(TestController.new)
@@ -937,9 +967,7 @@ class ControllerWithAllTypesOfFilters < PostsController
end
class ControllerWithTwoLessFilters < ControllerWithAllTypesOfFilters
- $vbf = true
skip_filter :around_again
- $vbf = false
skip_filter :after
end