提交 c6f9f8c2 编写于 作者: E Eileen M. Uchitelle 提交者: GitHub

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

Delete PATH_INFO after each controller test request
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册