aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application
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
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')
-rw-r--r--railties/test/application/middleware/show_exceptions_test.rb37
-rw-r--r--railties/test/application/middleware_test.rb4
2 files changed, 39 insertions, 2 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
diff --git a/railties/test/application/middleware_test.rb b/railties/test/application/middleware_test.rb
index 44dd0bc8e4..b314832685 100644
--- a/railties/test/application/middleware_test.rb
+++ b/railties/test/application/middleware_test.rb
@@ -78,10 +78,10 @@ module ApplicationTests
assert !middleware.include?("ActionDispatch::Static")
end
- test "removes show exceptions if action_dispatch.show_exceptions is disabled" do
+ test "includes show exceptions even action_dispatch.show_exceptions is disabled" do
add_to_config "config.action_dispatch.show_exceptions = false"
boot!
- assert !middleware.include?("ActionDispatch::ShowExceptions")
+ assert middleware.include?("ActionDispatch::ShowExceptions")
end
test "removes ActionDispatch::Reloader if cache_classes is true" do