diff options
author | lest <just.lest@gmail.com> | 2011-11-21 20:13:54 +0300 |
---|---|---|
committer | lest <just.lest@gmail.com> | 2011-11-22 11:38:24 +0300 |
commit | a9e8cf78fda696738f63e726796f6232c3751603 (patch) | |
tree | e1e12a371dd995ffc2f843ea9ae4fe8d4f7ada78 /actionpack/test/dispatch | |
parent | 8f57bf207ff4f28fa8da4544ebc573007b65439d (diff) | |
download | rails-a9e8cf78fda696738f63e726796f6232c3751603.tar.gz rails-a9e8cf78fda696738f63e726796f6232c3751603.tar.bz2 rails-a9e8cf78fda696738f63e726796f6232c3751603.zip |
add ActionController::Metal#show_detailed_exceptions?
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r-- | actionpack/test/dispatch/show_exceptions_test.rb | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/actionpack/test/dispatch/show_exceptions_test.rb b/actionpack/test/dispatch/show_exceptions_test.rb index 42f6c7f79f..09eebb3ab5 100644 --- a/actionpack/test/dispatch/show_exceptions_test.rb +++ b/actionpack/test/dispatch/show_exceptions_test.rb @@ -2,28 +2,35 @@ require 'abstract_unit' class ShowExceptionsTest < ActionDispatch::IntegrationTest - Boomer = lambda do |env| - req = ActionDispatch::Request.new(env) - case req.path - when "/not_found" - raise ActionController::UnknownAction - when "/runtime_error" - raise RuntimeError - when "/method_not_allowed" - raise ActionController::MethodNotAllowed - when "/not_implemented" - raise ActionController::NotImplemented - when "/unprocessable_entity" - raise ActionController::InvalidAuthenticityToken - when "/not_found_original_exception" - raise ActionView::Template::Error.new('template', {}, AbstractController::ActionNotFound.new) - else - raise "puke!" + class Boomer + def initialize(show_exceptions = false) + @show_exceptions = show_exceptions + end + + def call(env) + env['action_dispatch.show_exceptions'] = @show_exceptions + req = ActionDispatch::Request.new(env) + case req.path + when "/not_found" + raise ActionController::UnknownAction + when "/runtime_error" + raise RuntimeError + when "/method_not_allowed" + raise ActionController::MethodNotAllowed + when "/not_implemented" + raise ActionController::NotImplemented + when "/unprocessable_entity" + raise ActionController::InvalidAuthenticityToken + when "/not_found_original_exception" + raise ActionView::Template::Error.new('template', {}, AbstractController::ActionNotFound.new) + else + raise "puke!" + end end end - ProductionApp = ActionDispatch::ShowExceptions.new(Boomer, false) - DevelopmentApp = ActionDispatch::ShowExceptions.new(Boomer, true) + ProductionApp = ActionDispatch::ShowExceptions.new(Boomer.new(false)) + DevelopmentApp = ActionDispatch::ShowExceptions.new(Boomer.new(true)) test "rescue in public from a remote ip" do @app = ProductionApp |