When trying to make a test in http://ift.tt/2d3IUxM using 8.31 listing:
require 'test_helper'
class UsersLoginTest < ActionDispatch::IntegrationTest
.
.
.
test "login with valid information followed by logout" do
get login_path
post login_path, params: { session: { email: @user.email,
password: 'password' } }
assert is_logged_in?
assert_redirected_to @user
follow_redirect!
assert_template 'users/show'
assert_select "a[href=?]", login_path, count: 0
assert_select "a[href=?]", logout_path
assert_select "a[href=?]", user_path(@user)
delete logout_path
assert_not is_logged_in?
assert_redirected_to root_url
follow_redirect!
assert_select "a[href=?]", login_path
assert_select "a[href=?]", logout_path, count: 0
assert_select "a[href=?]", user_path(@user), count: 0
end
end
I am getting a failure:
FAIL["test_login_with_valid_information_followed_by_logout", UsersLoginTest, 1.7831762819550931]
test_login_with_valid_information_followed_by_logout#UsersLoginTest (1.78s)
Expected at least 1 element matching "a[href="/login"]", found 0..
Expected 0 to be >= 1.
test/integration/users_login_test.rb:35:in `block in <class:UsersLoginTest>'
Maybe someone know where is a problem? I double check the chapter, seems that everything is done as in tutorial said.
Much obliged,
Aucun commentaire:
Enregistrer un commentaire