# Problem with tests and cookies

**URL:** <https://www.ruby-forum.com/t/problem-with-tests-and-cookies/194972>\
**Category:** Rails\
**Created:** [September 14, 2010, 4:23pm UTC](https://www.ruby-forum.com/t/problem-with-tests-and-cookies/194972 "2010-09-14T16:23:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![albert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/48db29/32.png) [@albert](https://www.ruby-forum.com/u/albert)\
**Post date:** [September 14, 2010, 4:23pm UTC](https://www.ruby-forum.com/t/problem-with-tests-and-cookies/194972/1 "2010-09-14T16:23:23Z")

</div>

Hi, very briefly, this is my interaction in debugger mode in a  
controller test. I have my test where I initialize some cookies, but  
then the test itself, when the controller action is executed, fails  
because even though the cookies are properly set, when accessing them  
i always get nil. Not sure if this is a bug in Rails, any tips on  
this? Should I write in rails-core?

(rdb:1) cookies  
{:intranet\_id=\>“4”, :intranet\_hash=\>"$2a  
$10$byweo.aZfMGUpCjgoXjLD.exllI.K8PJ8LZZVnOuC6ve1TzT9Mg5y"}  
(rdb:1) cookies[:intranet\_id]  
nil  
(rdb:1) cookies.class  
ActionDispatch::Cookies::CookieJar

Thanks
