Patrick J. Collins
2011-Sep-20 21:45 UTC
[rspec-users] using rspec to verify an xpath (via capybara/cucumber)
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 ? Patrick J. Collins http://collinatorstudios.com
David Chelimsky
2011-Sep-20 21:57 UTC
[rspec-users] using rspec to verify an xpath (via capybara/cucumber)
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
Justin Ko
2011-Sep-20 22:01 UTC
[rspec-users] using rspec to verify an xpath (via capybara/cucumber)
"have_[xpath]" is a custom matcher in Capybara. So, the answer would be no. https://github.com/jnicklas/capybara/blob/master/lib/capybara/rspec/matchers.rb On Sep 20, 2011, at 3: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 ? > > Patrick J. Collins > http://collinatorstudios.com > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users