aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/response_test.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-09-23 11:23:13 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-09-23 11:23:22 -0700
commit4cf449df9136117f2f0acf9730bf754f889f4dfa (patch)
tree7e79711c460b540a1a56b3a9e6fa2d406f13d6ee /actionpack/test/dispatch/response_test.rb
parentf860ab3f1490c7b9839211593010a0421fb8dbf6 (diff)
downloadrails-4cf449df9136117f2f0acf9730bf754f889f4dfa.tar.gz
rails-4cf449df9136117f2f0acf9730bf754f889f4dfa.tar.bz2
rails-4cf449df9136117f2f0acf9730bf754f889f4dfa.zip
don't mutate a response object after to_a
When the response object is `to_a`'d, that means it's been written to the socket. It doesn't make sense to mutate the response object after it's been written (and this may raise an exception in the future).
Diffstat (limited to 'actionpack/test/dispatch/response_test.rb')
-rw-r--r--actionpack/test/dispatch/response_test.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/response_test.rb b/actionpack/test/dispatch/response_test.rb
index 8f4ba75842..024fd391d5 100644
--- a/actionpack/test/dispatch/response_test.rb
+++ b/actionpack/test/dispatch/response_test.rb
@@ -150,6 +150,8 @@ class ResponseTest < ActiveSupport::TestCase
assert_equal "user_name=david; path=/", headers["Set-Cookie"]
assert_equal({"user_name" => "david"}, @response.cookies)
+ @response = ActionDispatch::TestResponse.new
+ @response.set_cookie("user_name", :value => "david", :path => "/")
@response.set_cookie("login", :value => "foo&bar", :path => "/", :expires => Time.utc(2005, 10, 10,5))
status, headers, body = @response.to_a
assert_equal "user_name=david; path=/\nlogin=foo%26bar; path=/; expires=Mon, 10 Oct 2005 05:00:00 -0000", headers["Set-Cookie"]