Forum: Ruby on Rails Cookies and functional tests

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
David S. (Guest)
on 2006-04-03 17:09
(Received via mailing list)
Hi there

Is there any way that my functional tests can check to see if the
controller has set a cookie?

I've got this in a controller action;

   def login
     cookies[:foo] = 'bar'

Using a web browser, I can see that the cookie is being set when the
action is invoked. But, a functional test like this;

   def test_cookie
       assert_equal nil, cookies[:foo]

       post :login, :user => {
           :name => users(:david).name,
           :password => users(:david).password,

       assert_equal 'bar', cookies[:foo]

Fails, saying that cookies[:foo] is <nil>.

Is there anything I can do to have meaningful functional testing of
cookies that are set by my controllers?

Thanks in advance

This topic is locked and can not be replied to.