From 35fe3107a39271c9694e5094c1352c30463582e4 Mon Sep 17 00:00:00 2001 From: Brian John Date: Wed, 18 Jul 2012 19:50:25 -0500 Subject: Clean up Sweeper controller accessor when an Error is raised --- actionpack/test/controller/filters_test.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb index b9cb93f0f4..afc00a3c9d 100644 --- a/actionpack/test/controller/filters_test.rb +++ b/actionpack/test/controller/filters_test.rb @@ -505,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 @@ -534,6 +538,13 @@ class FilterTest < ActionController::TestCase 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) -- cgit v1.2.3