Testing Cookies in Rails

Hello,

I created a controller and within the controller I have two separate
functions that involve the cookie that I implemented:

def login
cookies[:login] = 1
end

def logout
if cookies[:login]
cookies.delete :login
end
end

When I try this out on the actual site, it seems to work rather well.
However, I also must create a functional test that tests for these
conditions in an automated manner. I managed to find a plugin called
assert_cookie that allows me to assert if there is a cookie at the
current time or not. When I attempted to use it, it did not have the
desired results.

The test came out to be like this:

post :login
assert_cookie :login

post :logout
assert_no_cookie :login

The result was that the first assertion succeeded but the second one
failed.

Using Netbeans debugger, I was able to step through the test to see
what was going on. It seems that when it enters the logout method,
the cookie does not seem to exist. It will check for cookies[:login]
and skip over the delete step. I tried to sift through @response and
other local variables, but cannot seem to figure why this is so. Does
anybody know what’s going on? Thanks in advance.