aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/middleware/show_exceptions_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-12-01 19:16:19 +0100
committerJosé Valim <jose.valim@gmail.com>2011-12-01 19:21:35 +0100
commitb4359bc7234b61c9a4a104542fa77f63bb84d7e1 (patch)
tree4e3c3693f60aa500f4ed96bf8721d859a8f126fc /railties/test/application/middleware/show_exceptions_test.rb
parent1e51cd957e3c90f4be35f1f0c4c380d8f7d40d66 (diff)
downloadrails-b4359bc7234b61c9a4a104542fa77f63bb84d7e1.tar.gz
rails-b4359bc7234b61c9a4a104542fa77f63bb84d7e1.tar.bz2
rails-b4359bc7234b61c9a4a104542fa77f63bb84d7e1.zip
Allow rescue responses to be configured through a railtie.
Diffstat (limited to 'railties/test/application/middleware/show_exceptions_test.rb')
-rw-r--r--railties/test/application/middleware/show_exceptions_test.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/railties/test/application/middleware/show_exceptions_test.rb b/railties/test/application/middleware/show_exceptions_test.rb
index 7dbadc6ce3..f3cae6a11e 100644
--- a/railties/test/application/middleware/show_exceptions_test.rb
+++ b/railties/test/application/middleware/show_exceptions_test.rb
@@ -16,6 +16,35 @@ module ApplicationTests
teardown_app
end
+ test "show exceptions middleware filter backtrace before logging" do
+ my_middleware = Struct.new(:app) do
+ def call(env)
+ raise "Failure"
+ end
+ end
+
+ app.config.middleware.use my_middleware
+
+ stringio = StringIO.new
+ Rails.logger = Logger.new(stringio)
+
+ get "/"
+ assert_no_match(/action_dispatch/, stringio.string)
+ end
+
+ test "renders active record exceptions as 404" do
+ my_middleware = Struct.new(:app) do
+ def call(env)
+ raise ActiveRecord::RecordNotFound
+ end
+ end
+
+ app.config.middleware.use my_middleware
+
+ get "/"
+ assert_equal 404, last_response.status
+ end
+
test "unspecified route when set action_dispatch.show_exceptions to false" do
app.config.action_dispatch.show_exceptions = false