This project is archived and is in readonly mode.
Cookie value set in functional test, key present in controller but unreadable
-
Andrew White
- State changed from new to open
- Milestone set to 3.0.6
- Assigned user set to Andrew White
- Importance changed from to Low
It looks as though this has been addressed in master somewhat, but you still need to use string keys when assigning the cookie in the request. The cookies hash is cached in the request and the symbol key is assigned. However the access in the controller is done using a string key and the nil value is cached in the hash so you end up with both the string and symbol keys in the cookies hash.
The fix is to clear the cookies instance variable when the request object is recycled, after first writing out the cookies to HTTP_COOKIE in the environment hash. AD::TestRequest.write_cookies! also needs fixing so that it escapes the cookie values as well.
I'll come up with a patch this weekend, in the meantime just assign cookie value using a string key.
-
Repository
- State changed from open to resolved
(from [e2523ff68309f444cd052031c1fe8a3030d2865a]) Improve testing of cookies in functional tests: - cookies can be set using string or symbol keys - cookies are preserved across calls to get, post, etc. - cookie names and values are escaped - cookies can be cleared using @request.cookies.clear
[#6272 state:resolved] https://github.com/rails/rails/commit/e2523ff68309f444cd052031c1fe8...
-
Repository
(from [31f09f9dbc1b8e598fc82d86b622167bfc01d18a]) Improve testing of cookies in functional tests: - cookies can be set using string or symbol keys - cookies are preserved across calls to get, post, etc. - cookie names and values are escaped - cookies can be cleared using @request.cookies.clear
[#6272 state:resolved] https://github.com/rails/rails/commit/31f09f9dbc1b8e598fc82d86b6221...