Following this tutorial: http://ift.tt/1HB8xgl and am at section 8.2.4 Testing layout changes. I am stuck on how to verify that the login link disappears.
Here are the first three steps:
1. Visit the login path.
2. Post valid information to the sessions path.
3. Verify that the login link disappears.
I know that I'll have to use an assert method of some kind. Here is what I have so far
test "testing layout changes" do
get login_path
assert_template 'sessions/new'
post login_path, session: {email: "abcd@example.com", password: "foobar"}
assert_not 'sessions/new'
end
For the assert_not 'sessions/new', I have also tried !assert_select "a[href=?]", login_path and assert_template 'sessions/new': nil and have not been able to make my test pass. I have spent a substantial amount of time on this and just am not sure how to proceed.
Aucun commentaire:
Enregistrer un commentaire