要素が存在しないことをテストするにはどうすればよいですか? 次のことを試しましたが、textarea#Question1Text does not exist
テストに合格する代わりにエラーが発生しました。
it "should not have question 1" do
find('textarea#Question1Text').should_not be
end
it { should_not find('textarea#Question1Text') }
have_css
要素が存在するかどうかをテストするために、カピバラマッチャーの 1 つ (具体的には ) を使用できます。
it 'should not have question1' do
page.should_not have_css('textarea#Question1Text')
end
簡単に
expect{page.find_by_id("update-#{term1.id}").should}.not_to raise_error
expect{page.find_by_id("update-#{term4.id}")}.to raise_error
一意の ID がない場合は、spullen が示唆する Css が機能します