簡體   English   中英

簡單的rspec測試失敗

[英]Simple rspec test failing

我本以為這個測試會通過。 任何想法為什么不是呢?

it 'should create an account' do
  visit new_user_registration_path
  fill_in 'user_email', with: 'newtest@test.com'
  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

這是計數器緩存問題,請參見: Rails counter_cache無法正確更新

愚蠢的錯誤。 我已經驗證了用戶的姓名!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM