The problem I''m having is that I can''t seem to destroy the
cookies and
assert that they were indeed destroyed inside the test.
The code to do this does work - the cookies are created, and are
destroyed when this is done in a browser, but I can''t seem to make the
test pass.
account_signup_test.rb
def test_should_pass_if_logout_destroys_cookie_data
post :login, { :user => { :login => ''ben'', :password
=> ''password''
}, :remember => 1 }
assert_equal(User.hash_password(''password''),
cookies["password"][0])
assert_equal(''ben'', cookies["login"][0])
get :logout
assert_nil cookies["password"][0]
assert_nil cookies["login"][0]
end
account_controller.rb
def logout
session[''user''] = nil
cookies.delete :login if cookies[:login]
cookies.delete :password if cookies[:password]
end
rake test failure (assert_nil cookies["password"][0] is what fails):
1) Failure:
test_should_pass_if_logout_destroys_cookie_data(AccountSignupTest)
[./test/functional/account/account_signup_test.rb:169]:
<nil> expected but was
<"5f4dcc3b5aa765d61d8327deb882cf99">.
---
Thanks in advance,
Benjamin Kuz
Bravenet Web Services
--
Posted via http://www.ruby-forum.com/.