[rspec-users] using rspec to verify an xpath (via capybara/cucumber)

David Chelimsky dchelimsky at gmail.com
Tue Sep 20 17:57:24 EDT 2011


On Sep 20, 2011, at 11:45 PM, Patrick J. Collins wrote:

> I am doing:
> 
> 	page.should have_xpath("//img[contains(@class, 'foobar')]", :count => 0)
> 
> but cucumber tells me:
> 
> expected xpath "//img[contains(@class, 'foobar')]" to return something
> (RSpec::Expectations::ExpectationNotMetError)
> 
> 
> ...  Shouldn't this be returning true/false ?

have_xpath is a Capybara matcher that defines its own failure message:

https://github.com/jnicklas/capybara/blob/master/lib/capybara/rspec/matchers.rb#L112-114

HTH,
David


More information about the rspec-users mailing list