diff options
Diffstat (limited to 'actionpack/test/dispatch/show_exceptions_test.rb')
-rw-r--r-- | actionpack/test/dispatch/show_exceptions_test.rb | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/actionpack/test/dispatch/show_exceptions_test.rb b/actionpack/test/dispatch/show_exceptions_test.rb index 14894d4b82..d8f673c212 100644 --- a/actionpack/test/dispatch/show_exceptions_test.rb +++ b/actionpack/test/dispatch/show_exceptions_test.rb @@ -1,7 +1,6 @@ -require 'abstract_unit' +require "abstract_unit" class ShowExceptionsTest < ActionDispatch::IntegrationTest - class Boomer def call(env) req = ActionDispatch::Request.new(env) @@ -15,14 +14,14 @@ class ShowExceptionsTest < ActionDispatch::IntegrationTest raise ActionDispatch::ParamsParser::ParseError end when "/method_not_allowed" - raise ActionController::MethodNotAllowed, 'PUT' + raise ActionController::MethodNotAllowed, "PUT" when "/unknown_http_method" raise ActionController::UnknownHttpMethod when "/not_found_original_exception" begin raise AbstractController::ActionNotFound.new rescue - raise ActionView::Template::Error.new('template') + raise ActionView::Template::Error.new("template") end else raise "puke!" @@ -35,30 +34,30 @@ class ShowExceptionsTest < ActionDispatch::IntegrationTest test "skip exceptions app if not showing exceptions" do @app = ProductionApp assert_raise RuntimeError do - get "/", headers: { 'action_dispatch.show_exceptions' => false } + get "/", headers: { "action_dispatch.show_exceptions" => false } end end test "rescue with error page" do @app = ProductionApp - get "/", headers: { 'action_dispatch.show_exceptions' => true } + get "/", headers: { "action_dispatch.show_exceptions" => true } assert_response 500 assert_equal "500 error fixture\n", body - get "/bad_params", headers: { 'action_dispatch.show_exceptions' => true } + get "/bad_params", headers: { "action_dispatch.show_exceptions" => true } assert_response 400 assert_equal "400 error fixture\n", body - get "/not_found", headers: { 'action_dispatch.show_exceptions' => true } + get "/not_found", headers: { "action_dispatch.show_exceptions" => true } assert_response 404 assert_equal "404 error fixture\n", body - get "/method_not_allowed", headers: { 'action_dispatch.show_exceptions' => true } + get "/method_not_allowed", headers: { "action_dispatch.show_exceptions" => true } assert_response 405 assert_equal "", body - get "/unknown_http_method", headers: { 'action_dispatch.show_exceptions' => true } + get "/unknown_http_method", headers: { "action_dispatch.show_exceptions" => true } assert_response 405 assert_equal "", body end @@ -69,11 +68,11 @@ class ShowExceptionsTest < ActionDispatch::IntegrationTest begin @app = ProductionApp - get "/", headers: { 'action_dispatch.show_exceptions' => true } + get "/", headers: { "action_dispatch.show_exceptions" => true } assert_response 500 assert_equal "500 localized error fixture\n", body - get "/not_found", headers: { 'action_dispatch.show_exceptions' => true } + get "/not_found", headers: { "action_dispatch.show_exceptions" => true } assert_response 404 assert_equal "404 error fixture\n", body ensure @@ -84,14 +83,14 @@ class ShowExceptionsTest < ActionDispatch::IntegrationTest test "sets the HTTP charset parameter" do @app = ProductionApp - get "/", headers: { 'action_dispatch.show_exceptions' => true } + get "/", headers: { "action_dispatch.show_exceptions" => true } assert_equal "text/html; charset=utf-8", response.headers["Content-Type"] end test "show registered original exception for wrapped exceptions" do @app = ProductionApp - get "/not_found_original_exception", headers: { 'action_dispatch.show_exceptions' => true } + get "/not_found_original_exception", headers: { "action_dispatch.show_exceptions" => true } assert_response 404 assert_match(/404 error/, body) end @@ -105,7 +104,7 @@ class ShowExceptionsTest < ActionDispatch::IntegrationTest end @app = ActionDispatch::ShowExceptions.new(Boomer.new, exceptions_app) - get "/not_found_original_exception", headers: { 'action_dispatch.show_exceptions' => true } + get "/not_found_original_exception", headers: { "action_dispatch.show_exceptions" => true } assert_response 404 assert_equal "YOU FAILED", body end @@ -116,7 +115,7 @@ class ShowExceptionsTest < ActionDispatch::IntegrationTest end @app = ActionDispatch::ShowExceptions.new(Boomer.new, exceptions_app) - get "/method_not_allowed", headers: { 'action_dispatch.show_exceptions' => true } + get "/method_not_allowed", headers: { "action_dispatch.show_exceptions" => true } assert_response 405 assert_equal "", body end @@ -124,12 +123,12 @@ class ShowExceptionsTest < ActionDispatch::IntegrationTest test "bad params exception is returned in the correct format" do @app = ProductionApp - get "/bad_params", headers: { 'action_dispatch.show_exceptions' => true } + get "/bad_params", headers: { "action_dispatch.show_exceptions" => true } assert_equal "text/html; charset=utf-8", response.headers["Content-Type"] assert_response 400 assert_match(/400 error/, body) - get "/bad_params.json", headers: { 'action_dispatch.show_exceptions' => true } + get "/bad_params.json", headers: { "action_dispatch.show_exceptions" => true } assert_equal "application/json; charset=utf-8", response.headers["Content-Type"] assert_response 400 assert_equal("{\"status\":400,\"error\":\"Bad Request\"}", body) |