mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Disable ShowExceptions during integration tests
This commit is contained in:
@@ -259,7 +259,9 @@ module ActionDispatch
|
||||
"HTTP_HOST" => host,
|
||||
"REMOTE_ADDR" => remote_addr,
|
||||
"CONTENT_TYPE" => "application/x-www-form-urlencoded",
|
||||
"HTTP_ACCEPT" => accept
|
||||
"HTTP_ACCEPT" => accept,
|
||||
|
||||
"action_dispatch.show_exceptions" => false
|
||||
}
|
||||
|
||||
(rack_environment || {}).each do |key, value|
|
||||
|
||||
@@ -35,7 +35,7 @@ class JsonParamsParsingTest < ActionController::IntegrationTest
|
||||
begin
|
||||
$stderr = StringIO.new
|
||||
json = "[\"person]\": {\"name\": \"David\"}}"
|
||||
post "/parse", json, {'CONTENT_TYPE' => 'application/json'}
|
||||
post "/parse", json, {'CONTENT_TYPE' => 'application/json', 'action_dispatch.show_exceptions' => true}
|
||||
assert_response :error
|
||||
$stderr.rewind && err = $stderr.read
|
||||
assert err =~ /Error occurred while parsing request parameters/
|
||||
|
||||
@@ -43,7 +43,7 @@ class XmlParamsParsingTest < ActionController::IntegrationTest
|
||||
begin
|
||||
$stderr = StringIO.new
|
||||
xml = "<person><name>David</name><avatar type='file' name='me.jpg' content_type='image/jpg'>#{ActiveSupport::Base64.encode64('ABC')}</avatar></pineapple>"
|
||||
post "/parse", xml, default_headers
|
||||
post "/parse", xml, default_headers.merge('action_dispatch.show_exceptions' => true)
|
||||
assert_response :error
|
||||
$stderr.rewind && err = $stderr.read
|
||||
assert err =~ /Error occurred while parsing request parameters/
|
||||
|
||||
@@ -38,15 +38,15 @@ class ShowExceptionsTest < ActionController::IntegrationTest
|
||||
@app = ProductionApp
|
||||
self.remote_addr = '208.77.188.166'
|
||||
|
||||
get "/"
|
||||
get "/", {}, {'action_dispatch.show_exceptions' => true}
|
||||
assert_response 500
|
||||
assert_equal "500 error fixture\n", body
|
||||
|
||||
get "/not_found"
|
||||
get "/not_found", {}, {'action_dispatch.show_exceptions' => true}
|
||||
assert_response 404
|
||||
assert_equal "404 error fixture\n", body
|
||||
|
||||
get "/method_not_allowed"
|
||||
get "/method_not_allowed", {}, {'action_dispatch.show_exceptions' => true}
|
||||
assert_response 405
|
||||
assert_equal "", body
|
||||
end
|
||||
@@ -56,15 +56,15 @@ class ShowExceptionsTest < ActionController::IntegrationTest
|
||||
['127.0.0.1', '::1'].each do |ip_address|
|
||||
self.remote_addr = ip_address
|
||||
|
||||
get "/"
|
||||
get "/", {}, {'action_dispatch.show_exceptions' => true}
|
||||
assert_response 500
|
||||
assert_match /puke/, body
|
||||
|
||||
get "/not_found"
|
||||
get "/not_found", {}, {'action_dispatch.show_exceptions' => true}
|
||||
assert_response 404
|
||||
assert_match /#{ActionController::UnknownAction.name}/, body
|
||||
|
||||
get "/method_not_allowed"
|
||||
get "/method_not_allowed", {}, {'action_dispatch.show_exceptions' => true}
|
||||
assert_response 405
|
||||
assert_match /ActionController::MethodNotAllowed/, body
|
||||
end
|
||||
@@ -78,11 +78,11 @@ class ShowExceptionsTest < ActionController::IntegrationTest
|
||||
@app = ProductionApp
|
||||
self.remote_addr = '208.77.188.166'
|
||||
|
||||
get "/"
|
||||
get "/", {}, {'action_dispatch.show_exceptions' => true}
|
||||
assert_response 500
|
||||
assert_equal "500 localized error fixture\n", body
|
||||
|
||||
get "/not_found"
|
||||
get "/not_found", {}, {'action_dispatch.show_exceptions' => true}
|
||||
assert_response 404
|
||||
assert_equal "404 error fixture\n", body
|
||||
ensure
|
||||
@@ -94,15 +94,15 @@ class ShowExceptionsTest < ActionController::IntegrationTest
|
||||
@app = DevelopmentApp
|
||||
self.remote_addr = '208.77.188.166'
|
||||
|
||||
get "/"
|
||||
get "/", {}, {'action_dispatch.show_exceptions' => true}
|
||||
assert_response 500
|
||||
assert_match /puke/, body
|
||||
|
||||
get "/not_found"
|
||||
get "/not_found", {}, {'action_dispatch.show_exceptions' => true}
|
||||
assert_response 404
|
||||
assert_match /#{ActionController::UnknownAction.name}/, body
|
||||
|
||||
get "/method_not_allowed"
|
||||
get "/method_not_allowed", {}, {'action_dispatch.show_exceptions' => true}
|
||||
assert_response 405
|
||||
assert_match /ActionController::MethodNotAllowed/, body
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user