Cookies and functional tests


#1

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’
end

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]

end

Fails, saying that cookies[:foo] is .

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

Thanks in advance

David