aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2013-01-05 13:59:00 +0100
committerYves Senn <yves.senn@gmail.com>2013-01-05 14:31:03 +0100
commit80795e02ca7025651ee7abc2e85e123e5e0a7ad6 (patch)
tree8dc6b747221945e37a0ea1959a9c567271a16cdc /actionpack/test
parentaf5c0fd85fce1adb311083dd1ecf96432ee8caa3 (diff)
downloadrails-80795e02ca7025651ee7abc2e85e123e5e0a7ad6.tar.gz
rails-80795e02ca7025651ee7abc2e85e123e5e0a7ad6.tar.bz2
rails-80795e02ca7025651ee7abc2e85e123e5e0a7ad6.zip
display mountable engine routes on RoutingError.
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/dispatch/debug_exceptions_test.rb22
1 files changed, 20 insertions, 2 deletions
diff --git a/actionpack/test/dispatch/debug_exceptions_test.rb b/actionpack/test/dispatch/debug_exceptions_test.rb
index 39e791b4f4..1319eba9ac 100644
--- a/actionpack/test/dispatch/debug_exceptions_test.rb
+++ b/actionpack/test/dispatch/debug_exceptions_test.rb
@@ -45,8 +45,17 @@ class DebugExceptionsTest < ActionDispatch::IntegrationTest
end
end
- ProductionApp = ActionDispatch::DebugExceptions.new(Boomer.new(false))
- DevelopmentApp = ActionDispatch::DebugExceptions.new(Boomer.new(true))
+ def setup
+ app = ActiveSupport::OrderedOptions.new
+ app.config = ActiveSupport::OrderedOptions.new
+ app.config.assets = ActiveSupport::OrderedOptions.new
+ app.config.assets.prefix = '/sprockets'
+ Rails.stubs(:application).returns(app)
+ end
+
+ RoutesApp = Struct.new(:routes).new(SharedTestRoutes)
+ ProductionApp = ActionDispatch::DebugExceptions.new(Boomer.new(false), RoutesApp)
+ DevelopmentApp = ActionDispatch::DebugExceptions.new(Boomer.new(true), RoutesApp)
test 'skip diagnosis if not showing detailed exceptions' do
@app = ProductionApp
@@ -78,6 +87,15 @@ class DebugExceptionsTest < ActionDispatch::IntegrationTest
assert boomer.closed, "Expected to close the response body"
end
+ test 'displays routes in a table when a RoutingError occurs' do
+ @app = DevelopmentApp
+ get "/pass", {}, {'action_dispatch.show_exceptions' => true}
+ routing_table = body[/route_table.*<.table>/m]
+ assert_match '/:controller(/:action)(.:format)', routing_table
+ assert_match ':controller#:action', routing_table
+ assert_no_match '&lt;|&gt;', routing_table, "there should not be escaped html in the output"
+ end
+
test "rescue with diagnostics message" do
@app = DevelopmentApp