aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/middleware/show_exceptions_test.rb
diff options
context:
space:
mode:
authorPrem Sichanugrist <s@sikachu.com>2011-02-23 03:02:39 +0700
committerAaron Patterson <aaron.patterson@gmail.com>2011-02-25 10:03:53 -0800
commit515ea955b6a80ab9f527ad0f6dcc25a17688a02c (patch)
tree4d610b79a6a304d3732366ad12ae5560e2952ff1 /railties/test/application/middleware/show_exceptions_test.rb
parent439a74520daa6ff255c83000cf6b0f3407805acf (diff)
downloadrails-515ea955b6a80ab9f527ad0f6dcc25a17688a02c.tar.gz
rails-515ea955b6a80ab9f527ad0f6dcc25a17688a02c.tar.bz2
rails-515ea955b6a80ab9f527ad0f6dcc25a17688a02c.zip
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.
Diffstat (limited to 'railties/test/application/middleware/show_exceptions_test.rb')
-rw-r--r--railties/test/application/middleware/show_exceptions_test.rb37
1 files changed, 37 insertions, 0 deletions
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