Reputation: 405
Why does the following step pass:
page.has_css?("doesnt exist")
when this correctly fails:
page.should have_css("doesnt exist")
If I run:
puts page.has_css?("doesnt exist")
it prints "false", but the step still passes.
Any idea why?
Upvotes: 1
Views: 1502
Reputation: 1720
You should probably have:
assert page.has_css?("doesnt exist")
If you write "2 == 3" in a test, it will evaluate to false, but the test method will not necessarily fail. You need an assert. I think the "should" style syntax are doing some kind of assert under the hood as well.
Upvotes: 2