aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-10-28 02:45:29 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-10-28 02:45:29 -0200
commita05f410029a0f8bff81d4a4aa3285a5b3c9d1816 (patch)
treeeb0fc4445b6537457c9b36a656a74c46794e709c /actionpack/lib
parent80c6b901d4d87cee610ab0a438ff6e3c6bf118d1 (diff)
downloadrails-a05f410029a0f8bff81d4a4aa3285a5b3c9d1816.tar.gz
rails-a05f410029a0f8bff81d4a4aa3285a5b3c9d1816.tar.bz2
rails-a05f410029a0f8bff81d4a4aa3285a5b3c9d1816.zip
Write the cookie jar it was not committed in TestCase
For ActionController::Base we write the cookies in a middleware if it was not yet committed no matter if the response was committed or not. [1] For ActionController::Live we write the cookies before the response is committed. [2] We already mimic ActionController::Live in ActionController::TestCase but we don't mimic the ActionController::Base behavior because we were checking if the response was committed before writing the cookies. Now we are matching the behavior of the middleware and writing the cookies if it was not written before. [1]: https://github.com/rails/rails/blob/80c6b901d4d87cee610ab0a438ff6e3c6bf118d1/actionpack/lib/action_dispatch/middleware/cookies.rb#L599-L604 [2]: https://github.com/rails/rails/blob/80c6b901d4d87cee610ab0a438ff6e3c6bf118d1/actionpack/lib/action_controller/metal/live.rb#L218-L223
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/test_case.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index 380e9d29b4..2cada1f68a 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -522,7 +522,7 @@ module ActionController
@request.delete_header 'HTTP_COOKIE'
if @request.have_cookie_jar?
- unless @response.committed?
+ unless @request.cookie_jar.committed?
@request.cookie_jar.write(@response)
self.cookies.update(@request.cookie_jar.instance_variable_get(:@cookies))
end