diff options
author | Dominic Cleal <dominic@cleal.org> | 2017-01-20 14:33:52 +0000 |
---|---|---|
committer | Dominic Cleal <dominic@cleal.org> | 2017-01-23 17:56:57 +0000 |
commit | 13c7f2b537b580beb5f3df29b8396d2157bdfdab (patch) | |
tree | 4a880692055af920da504e56e7f213c849b3e1e9 /actionpack/test | |
parent | c309073c7476f50dfb1e796d058580f176101c36 (diff) | |
download | rails-13c7f2b537b580beb5f3df29b8396d2157bdfdab.tar.gz rails-13c7f2b537b580beb5f3df29b8396d2157bdfdab.tar.bz2 rails-13c7f2b537b580beb5f3df29b8396d2157bdfdab.zip |
Delete PATH_INFO after each controller test request
Prevents PATH_INFO from being used to infer the request format in later
test requests when no explicit format is given.
As the request PATH_INFO may be set before a request, it can't be
deleted during pre-request scrubbing.
Fixes #27774
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/test_case_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/test/controller/test_case_test.rb b/actionpack/test/controller/test_case_test.rb index 874f9c3c42..ac99830208 100644 --- a/actionpack/test/controller/test_case_test.rb +++ b/actionpack/test/controller/test_case_test.rb @@ -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 |