From 515ea955b6a80ab9f527ad0f6dcc25a17688a02c Mon Sep 17 00:00:00 2001 From: Prem Sichanugrist Date: Wed, 23 Feb 2011 03:02:39 +0700 Subject: Always use ActionDispatch::ShowExceptions middleware [#6462 state:resolved] This will make sure the application will raise `ActionController::RoutingError` in case "X-Cascade: pass" header was set, usually when there's no route match. --- .../application/middleware/show_exceptions_test.rb | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 railties/test/application/middleware/show_exceptions_test.rb (limited to 'railties/test/application/middleware') diff --git a/railties/test/application/middleware/show_exceptions_test.rb b/railties/test/application/middleware/show_exceptions_test.rb new file mode 100644 index 0000000000..5487e41e0a --- /dev/null +++ b/railties/test/application/middleware/show_exceptions_test.rb @@ -0,0 +1,37 @@ +require 'isolation/abstract_unit' + +module ApplicationTests + class ShowExceptionsTest < Test::Unit::TestCase + include ActiveSupport::Testing::Isolation + + def setup + build_app + boot_rails + FileUtils.rm_rf "#{app_path}/config/environments" + end + + def app + @app ||= Rails.application + end + + test "unspecified route when set action_dispatch.show_exceptions to false" do + make_basic_app do |app| + app.config.action_dispatch.show_exceptions = false + end + + assert_raise(ActionController::RoutingError) do + get '/foo' + end + end + + test "unspecified route when set action_dispatch.show_exceptions to true" do + make_basic_app do |app| + app.config.action_dispatch.show_exceptions = true + end + + assert_nothing_raised(ActionController::RoutingError) do + get '/foo' + end + end + end +end -- cgit v1.2.3