diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-07-08 16:27:02 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-07-08 16:27:02 -0700 |
commit | 9f09848918e5f499e9d07a734345ee106d0fb9f9 (patch) | |
tree | ec3377201a186d8e65fcfa15b44f2d5118d01f91 | |
parent | f65fd25f0491919ef9db6e79be43f5d6f518374a (diff) | |
download | rails-9f09848918e5f499e9d07a734345ee106d0fb9f9.tar.gz rails-9f09848918e5f499e9d07a734345ee106d0fb9f9.tar.bz2 rails-9f09848918e5f499e9d07a734345ee106d0fb9f9.zip |
assign the cookie hash on request allocation
this prevents mutations from being available globally
-rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/testing/test_request.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 6095f1b95e..788fc9fe7d 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -18,6 +18,7 @@ module ActionController def self.create env = {} env = Rails.application.env_config.merge(env) if defined?(Rails.application) && Rails.application + env["rack.request.cookie_hash"] = {}.with_indifferent_access new(default_env.merge(env), new_session) end @@ -514,7 +515,6 @@ module ActionController end @request = TestRequest.create - @request.env["rack.request.cookie_hash"] = {}.with_indifferent_access @response = build_response @response_klass @response.request = @request diff --git a/actionpack/lib/action_dispatch/testing/test_request.rb b/actionpack/lib/action_dispatch/testing/test_request.rb index b9d11cb530..ad1a7f7109 100644 --- a/actionpack/lib/action_dispatch/testing/test_request.rb +++ b/actionpack/lib/action_dispatch/testing/test_request.rb @@ -7,12 +7,12 @@ module ActionDispatch 'HTTP_HOST' => 'test.host', 'REMOTE_ADDR' => '0.0.0.0', 'HTTP_USER_AGENT' => 'Rails Testing', - "rack.request.cookie_hash" => {}.with_indifferent_access ) # Create a new test request with default `env` values def self.create(env = {}) env = Rails.application.env_config.merge(env) if defined?(Rails.application) && Rails.application + env["rack.request.cookie_hash"] ||= {}.with_indifferent_access new(default_env.merge(env)) end |