RecordNotFound
例外を受け取ります。visit
にCapybaraのページがあり、それはjs: true
(Poltergeistドライバを使用して)で起きています。ポピュラージストとCapybaraを使用したRecordNotFound
マイ機能の仕様は次のようになります。
context 'existing submissions' do
background do
@problem = create(:problem)
@input = create(:input, problem: @problem)
end
scenario 'goes back and edits', js: true do
visit "/problems/#{@problem.id}/#{@input.lens}"
そして、私はbyebug
に落下するとき、私はこれを見ています:
[27, 36] in /Users/danielklasson/third_space/spec/features/user_completes_solving_process_spec.rb
30: scenario 'goes back and edits', js: true do
31: byebug
=> 32: visit "/problems/#{@problem.id}/#{@input.lens}"
(byebug) visit "/problems/#{@problem.id}/#{@input.lens}"
{"status"=>"success"}
(byebug)
*** ActiveRecord::RecordNotFound Exception: Couldn't find Problem with 'id'=1
nil
(byebug) Problem.all
#<ActiveRecord::Relation [#<Problem id: 1, name: "My Problem", created_at: "2017-01-25 15:35:12", updated_at: "2017-01-25 15:35:12">]>
そして、私のコントローラで、私は単純に、この持っている:
@problem = Problem.find(params[:id])
を