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

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

This reverts commit c6f9f8c28a, reversing
changes made to c309073c74.

Reason: This is fixing the behavior in the wrong place. Now the request
path after the request is nil and there is no way to assert that.
Also the test that was added in that PR also fails in 4.2 where the
reporter says it was passing. The reason the bahavior changed between
Rails 4.2 and Rails 5 is that the format in the path is now respected.
The correct way to fix the problem is not doign two requests in the same
controller test and use integrations tests. This change caused a
regression between Rails 5.0.1 and 5.0.2.
This commit is contained in:
Rafael Mendonça França 2017-03-21 13:37:53 -04:00
parent ad37b79ec4
commit 843345cae5
No known key found for this signature in database
GPG key ID: FC23B6D0F1EEE948
2 changed files with 5 additions and 15 deletions

View file

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

View file

@ -679,6 +679,11 @@ XML
assert_equal "baz", @request.filtered_parameters[:foo]
end
def test_path_is_kept_after_the_request
get :test_params, params: { id: "foo" }
assert_equal "foo", @request.path
end
def test_path_params_reset_between_request
get :test_params, params: { id: "foo" }
assert_equal "foo", @request.path_parameters[:id]
@ -728,20 +733,6 @@ 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