Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete PATH_INFO after each controller test request #27775

Merged
merged 1 commit into from
Jan 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions actionpack/lib/action_controller/test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions actionpack/test/controller/test_case_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down