diff options
author | José Valim <jose.valim@gmail.com> | 2011-12-16 09:45:14 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-12-16 10:45:59 +0100 |
commit | 7dd1c751f90858cbdfaebeafed5fdf1ef400ae8b (patch) | |
tree | 2b1ce586925782ed1a8154737c325825b5b52d85 /actionpack/test/dispatch | |
parent | 02127e64061fc61868f085102277ac5b679e0f75 (diff) | |
download | rails-7dd1c751f90858cbdfaebeafed5fdf1ef400ae8b.tar.gz rails-7dd1c751f90858cbdfaebeafed5fdf1ef400ae8b.tar.bz2 rails-7dd1c751f90858cbdfaebeafed5fdf1ef400ae8b.zip |
Improve the specs on exceptions app.
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r-- | actionpack/test/dispatch/show_exceptions_test.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/actionpack/test/dispatch/show_exceptions_test.rb b/actionpack/test/dispatch/show_exceptions_test.rb index d3c99e4f31..0ebe281ada 100644 --- a/actionpack/test/dispatch/show_exceptions_test.rb +++ b/actionpack/test/dispatch/show_exceptions_test.rb @@ -20,7 +20,7 @@ class ShowExceptionsTest < ActionDispatch::IntegrationTest ProductionApp = ActionDispatch::ShowExceptions.new(Boomer.new, ActionDispatch::PublicExceptions.new("#{FIXTURE_LOAD_PATH}/public")) - test 'skip diagnosis if not showing exceptions' do + test "skip exceptions app if not showing exceptions" do @app = ProductionApp assert_raise RuntimeError do get "/", {}, {'action_dispatch.show_exceptions' => false} @@ -75,4 +75,17 @@ class ShowExceptionsTest < ActionDispatch::IntegrationTest assert_response 404 assert_match(/404 error/, body) end + + test "calls custom exceptions app" do + exceptions_app = lambda do |env| + assert_kind_of AbstractController::ActionNotFound, env["action_dispatch.exception"] + assert_equal "/404", env["PATH_INFO"] + [404, { "Content-Type" => "text/plain" }, ["YOU FAILED BRO"]] + end + + @app = ActionDispatch::ShowExceptions.new(Boomer.new, exceptions_app) + get "/not_found_original_exception", {}, {'action_dispatch.show_exceptions' => true} + assert_response 404 + assert_equal "YOU FAILED BRO", body + end end |