저는 레일에서 새로 왔으며 capybara rspec 및 공장 아가씨와 함께 내 사기 도구 사용자를 테스트하고 있습니다.테스트 데비안 capybara rspec 및 공장 걸 사용하기
여기 사양 코드입니다 :
require 'rails_helper'
RSpec.describe User, type: :request do
it "displays the user's email after successful login" do
user = FactoryGirl.create(:user, email: '[email protected]', password: 'password')
visit root_url
fill_in 'Email', with: '[email protected]'
fill_in 'Password', with: 'password'
click_button 'Log in'
expect page.has_content?('jdoe')
end
end
문제는 여기에
에있는 공장이다 :expect page.has_content?('jdoe') No matter what i put instead 'jdoe' test works perfectly without any errors.
FactoryGirl.define do
factory :user do
email '[email protected]'
password 'password'
password_confirmation 'password'
end
end
어쩌면 내가 뭔가 또는 잘못된 방향으로 가고를 놓쳤다. 여기서 어떻게 테스트해야합니까? 여기
당신은 jdoe ' –
1 예를 테스트 @의 test.com'' 0 실패 'have_content .TO (페이지) 기대'시도 할 수 jdoe '도 녹색이다, 나는 정확하게 이해했다? –
그래서 have_content .TO (페이지) 기대'테스트 ''는 것과 같이, –