Permalink
Browse files

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

Delete PATH_INFO after each controller test request
  • Loading branch information...
eileencodes committed Jan 23, 2017
2 parents c309073 + 13c7f2b commit c6f9f8c28a720ad4ec7cf3613dddfa451d5968e2
Showing with 15 additions and 0 deletions.
  1. +1 −0 actionpack/lib/action_controller/test_case.rb
  2. +14 −0 actionpack/test/controller/test_case_test.rb
@@ -534,6 +534,7 @@ def process(action, method: "GET", params: {}, session: nil, body: nil, flash: {
@request.delete_header "HTTP_ACCEPT"
end
@request.query_string = ""
@request.env.delete "PATH_INFO"
@response.sent!
end
@@ -728,6 +728,20 @@ def test_request_format_kwarg
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

0 comments on commit c6f9f8c

Please sign in to comment.