我可以使用Poletergeist和Capybara在选择中测试选项的负面存在

时间:2014-11-22 00:57:23

标签: capybara integration-testing poltergeist

如果我有这个HTML:

<select name"bo">
    <option value="yo">Yo</option>
    <option value="ho">Ho</option>
    <option value="go">Go</option>
</select>

我可以使用什么步骤定义Capybara利用Poltergeist在此步骤中进行失败的测试:

Then Select "bo" does not contain the "yo" option

1 个答案:

答案 0 :(得分:1)

我想我理解你的问题。你可以这样做:

it "doesn't find element" do
  visit whatever_path
  expect { select "NotARealOption", from: "bo" }.to raise_error(SomeCapybaraError, "no match found")
end
相关问题