0
안녕하세요, 저는 Hartl의 Ruby on Rails 튜토리얼을 진행 중이며 9.1 장의 테스트 중 하나가 실패했습니다. 내가 터미널에서 스펙을 실행하면 반환 : 여기 Michael Hartl의 Ruby on Rails 튜토리얼. 9.1 장의 실패 테스트
sis-macbook-pro:sample_app Lagaspi$ bundle exec rspec spec/
...............................F................................
Failures:
1) AuthenticationPages signin with valid information
Failure/Error: it { should have_link('Users', href: users_path) }
expected link "Users" to return something
# ./spec/requests/authentication_pages_spec.rb:37:in `block (4 levels) in <top (required)>'
Finished in 1.42 seconds
64 examples, 1 failure
Failed examples:
rspec ./spec/requests/authentication_pages_spec.rb:37 # AuthenticationPages signin with valid information
내 코드입니다 - authentication_pages_spec.rb
require 'spec_helper'
describe "AuthenticationPages" do
subject { page }
describe "signin page" do
before { visit signin_path }
it { should have_selector('h1', text: 'Sign in') }
it { should have_selector('title', text: 'Sign in') }
end
describe "signin" do
before { visit signin_path }
describe "with invalid information" do
before { click_button "Sign in" }
it { should have_selector('title', text: 'Sign in') }
it { should have_selector('div.alert.alert-error', text: 'Invalid') }
describe "after visiting another page" do
before { click_link "Home" }
it { should_not have_selector('div.alert.alert-error') }
end
end
describe "with valid information" do
let(:user) { FactoryGirl.create(:user) }
before { sign_in user }
it { should have_selector('title', text: user.name) }
it { should have_link('Profile', href: user_path(user)) }
it { should have_link('Sign out', href: signout_path) }
it { should have_link('Settings', href: edit_user_path(user)) }
it { should have_link('Users', href: users_path) }
it { should_not have_link('Sign in', href: signin_path) }
describe "followed by signout" do
before { click_link "Sign out" }
it { should have_link('Sign in') }
end
end
end
end
그리고 나는이 문제 선 (37) 생각 :
it { should have_link('Users', href: users_path) }
그러나 나는 어떻게해야합니까? 나는 초보자이고 그것을 알아낼 수 없습니다. 고마워요. 당신이 자습서를 다음과 같은 경우 사용자가 로그인 한 경우
선을 변경 포함한다. 너는 자리에있다! –