2013-07-26 5 views
1

나는 모든 종류의 다른 것들을 시도해 보았고 다음과 같은 것을 얻을 수는 없습니다. 여기 FactoryGirl에서 생성 한 사용자를 Sorcery로 테스트하려면 어떻게해야합니까?

내 공장 :

FactoryGirl.define do 
    factory :user do 
    username    "user" 
    email     "[email protected]" 
    password    "userpass" 
    password_confirmation "userpass" 
    end 
end 

그리고 여기 내 테스트입니다 : (: 사용자)

이 하자 할 "올바른 정보와 함께"설명 {FactoryGirl.create (: 사용자)}

before do 
    fill_in 'Username', with: user.username.upcase 
    fill_in 'Password', with: user.password 
    click_button 'Sign in' 
    binding.pry 
    end 

편집 :binding.pryuser.password이것을 나에게 보여줍니다3210. 비밀번호가 하드 코드되지 않은 경우에도 작동하지 않는 것 같습니다.

답변

0

이 작동하지만,이 암호를 하드 코딩이 필요합니다 할

은 "올바른 정보와 함께"설명 : 여기에

내 공장 :

FactoryGirl.define do 
    factory :user do 
    username    "user" 
    email     "[email protected]" 
    password    "userpass" 
    password_confirmation "userpass" 
    end 
end 

그리고 여기 내 테스트입니다 let (: user) {FactoryGirl.create (: user)}

before do 
    fill_in 'Username', with: user.username 
    fill_in 'Password', with: "userpass" 
    click_button 'Sign in' 
    end