aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2008-07-16 18:51:40 +0100
committerPratik Naik <pratiknaik@gmail.com>2008-07-16 18:54:08 +0100
commit90c930f45c5c6766306929241462ffff8f67b86e (patch)
tree0c8a34193358991700b5142afdb4386af3d09d3b /actionpack/test
parentc64d749abdf31a2be322b1787165024067abbda7 (diff)
downloadrails-90c930f45c5c6766306929241462ffff8f67b86e.tar.gz
rails-90c930f45c5c6766306929241462ffff8f67b86e.tar.bz2
rails-90c930f45c5c6766306929241462ffff8f67b86e.zip
Allow Dispatcher exceptions to be handled in application.rb using rescue_from
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/rescue_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/actionpack/test/controller/rescue_test.rb b/actionpack/test/controller/rescue_test.rb
index 27fcc5e04c..da076d2090 100644
--- a/actionpack/test/controller/rescue_test.rb
+++ b/actionpack/test/controller/rescue_test.rb
@@ -62,6 +62,11 @@ class RescueController < ActionController::Base
render :text => exception.message
end
+ # This is a Dispatcher exception and should be in ApplicationController.
+ rescue_from ActionController::RoutingError do
+ render :text => 'no way'
+ end
+
def raises
render :text => 'already rendered'
raise "don't panic!"
@@ -378,6 +383,10 @@ class RescueTest < Test::Unit::TestCase
assert_equal "RescueController::ResourceUnavailableToRescueAsString", @response.body
end
+ def test_rescue_dispatcher_exceptions
+ RescueController.process_with_exception(@request, @response, ActionController::RoutingError.new("Route not found"))
+ assert_equal "no way", @response.body
+ end
protected
def with_all_requests_local(local = true)