2013-10-21 99 views
0

我原以爲這個測試會通過。任何想法爲什麼它不是?簡單的rspec測試失敗

it 'should create an account' do 
    visit new_user_registration_path 
    fill_in 'user_email', with: '[email protected]' 
    fill_in 'user_password', with: 'testing123' 
    fill_in 'user_password_confirmation', with: 'testing123' 
    expect{ 
    click_button 'Sign Up' 
    }.to change{User.count}.by(1) 
end 

我只是得到

result should have been changed by 1, but was changed by 0 
+0

您確定在註冊過程中沒有錯誤嗎? current_path在註冊步驟後會給你什麼? – usha

+1

完全相同的例子在我的應用程序(與設計)工作。也許你的用戶有任何其他驗證要求?當你將這些步驟設置爲manualy時,一切正常? – Adeptus

回答

0

愚蠢的錯誤。我對用戶的姓名進行了驗證!