diff options
author | José Valim <jose.valim@gmail.com> | 2010-06-09 22:48:50 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-06-09 22:49:14 +0200 |
commit | 211799450d25c3e6a42a48a5146af5bed78cd66d (patch) | |
tree | 282531aade31095f24232771bfabd871d1c9f20d /railties/test | |
parent | fa15111d30f05edac7e4f63264e25887a5a4ae20 (diff) | |
download | rails-211799450d25c3e6a42a48a5146af5bed78cd66d.tar.gz rails-211799450d25c3e6a42a48a5146af5bed78cd66d.tar.bz2 rails-211799450d25c3e6a42a48a5146af5bed78cd66d.zip |
Ensure show exceptions middleware properly filters backtrace before logging.
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/application/middleware_test.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/railties/test/application/middleware_test.rb b/railties/test/application/middleware_test.rb index aa75fed793..999f666a64 100644 --- a/railties/test/application/middleware_test.rb +++ b/railties/test/application/middleware_test.rb @@ -1,4 +1,5 @@ require 'isolation/abstract_unit' +require 'stringio' module ApplicationTests class MiddlewareTest < Test::Unit::TestCase @@ -163,6 +164,25 @@ module ApplicationTests assert_equal "1.1.1.1", remote_ip("REMOTE_ADDR" => "4.2.42.42,1.1.1.1") end + test "show exceptions middleware filter backtrace before logging" do + my_middleware = Struct.new(:app) do + def call(env) + raise "Failure" + end + end + + make_basic_app do |app| + app.config.middleware.use my_middleware + end + + stringio = StringIO.new + Rails.logger = Logger.new(stringio) + + env = Rack::MockRequest.env_for("/") + Rails.application.call(env) + assert_no_match(/action_dispatch/, stringio.string) + end + private def boot! |