Permalink
Browse files

Fix test_rescue_routing_exceptions when running with rake

  • Loading branch information...
1 parent 0b92bb9 commit 380431e4ed12d184c4e4891fbb74fdc38a51d2f2 @josh josh committed Apr 22, 2009
Showing with 15 additions and 13 deletions.
  1. +15 −13 actionpack/test/controller/rescue_test.rb
@@ -522,6 +522,12 @@ def test_exception_in_parent_controller
end
end
+class ApplicationController < ActionController::Base
+ rescue_from ActionController::RoutingError do
+ render :text => 'no way'
+ end
+end
+
class RescueTest < ActionController::IntegrationTest
class TestController < ActionController::Base
class RecordInvalid < StandardError
@@ -549,16 +555,6 @@ def show_errors(exception)
end
end
- def setup
- ActionController::Base.rescue_from ActionController::RoutingError do
- render :text => 'no way'
- end
- end
-
- def teardown
- ActionController::Base.rescue_handlers.clear
- end
-
test 'normal request' do
with_test_routing do
get '/foo'
@@ -574,9 +570,15 @@ def teardown
end
test 'rescue routing exceptions' do
- with_test_routing do
- get '/no_way'
- assert_equal 'no way', response.body
+ assert_equal 1, ApplicationController.rescue_handlers.length
+
+ begin
+ with_test_routing do
+ get '/no_way'
+ assert_equal 'no way', response.body
+ end
+ ensure
+ ActionController::Base.rescue_handlers.clear
end
end

0 comments on commit 380431e

Please sign in to comment.