尝试在一个简单的功能规范中使用 javascript,但我什至无法访问该页面。
describe "DiskFiles" do
...
describe "update action", js: true do
before(:each) do
df = FactoryGirl.create(:disk_file)
visit edit_disk_file_path(df)
end
it "should not show checkmark if no match" do
expect(page).to_not have_content "✓"
end
end
end
我收到此错误:
1) DiskFiles update action should not show checkmark if no match
Failure/Error: Unable to find matching line from backtrace
ActiveRecord::RecordNotFound:
Couldn't find DiskFile with id=7598 [WHERE "disk_items"."type" IN ('DiskFile')]
# ./app/controllers/disk_files_controller.rb:89:in `set_disk_file'
这让我感到困惑,因为我刚刚在其中创建了该记录,before(:each)
并且当我删除它时它通过了js: true
。
我错过了什么?