1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #27775 from domcleal/27774-format-reset

Delete PATH_INFO after each controller test request
This commit is contained in:
Eileen M. Uchitelle 2017-01-23 16:33:42 -05:00 committed by GitHub
commit c6f9f8c28a
2 changed files with 15 additions and 0 deletions

View file

@ -534,6 +534,7 @@ module ActionController
@request.delete_header "HTTP_ACCEPT"
end
@request.query_string = ""
@request.env.delete "PATH_INFO"
@response.sent!
end

View file

@ -728,6 +728,20 @@ XML
assert_equal "text/html", @response.body
end
def test_request_path_info_and_format_reset
get :test_format, format: "json"
assert_equal "application/json", @response.body
get :test_uri, format: "json"
assert_equal "/test_case_test/test/test_uri.json", @response.body
get :test_format
assert_equal "text/html", @response.body
get :test_uri
assert_equal "/test_case_test/test/test_uri", @response.body
end
def test_request_format_kwarg_overrides_params
get :test_format, format: "json", params: { format: "html" }
assert_equal "application/json", @response.body