Merge pull request #1798 from jeroenj/cachesweeper-fix

Fixes an issue where cache sweepers with only after filters would have no controller object
This commit is contained in:
Santiago Pastorino
2011-06-22 10:48:19 -07:00
2 changed files with 6 additions and 0 deletions

View File

@@ -61,6 +61,7 @@ module ActionController #:nodoc:
end
def after(controller)
self.controller = controller
callback(:after) if controller.perform_caching
# Clean up, so that the controller can be collected after this request
self.controller = nil

View File

@@ -530,6 +530,11 @@ class FilterTest < ActionController::TestCase
assert sweeper.before(TestController.new)
end
def test_after_method_of_sweeper_should_always_return_nil
sweeper = ActionController::Caching::Sweeper.send(:new)
assert_nil sweeper.after(TestController.new)
end
def test_non_yielding_around_filters_not_returning_false_do_not_raise
controller = NonYieldingAroundFilterController.new
controller.instance_variable_set "@filter_return_value", true