I know that in Capybara, you can do something like this:
page.should have_css("ol li", :count => 2) However, assuming that page has for instance only one matching element, the error is not very descriptive:
1) initial page load shows greetings Failure/Error: page.should have_css("ol li", :count => 2) expected css "ol li" to return something Instead of this rather obscure error message, is there a way to write the assertion in such way that error output would be something like 'When matching 'ol li', expected: 2, found: 1'. Obviously I could make a custom logic myself for such a behaviour - I'm asking is there a way to do this 'out of the box'?
For what it's worth, I'm using Selenium driver and RSpec.
page.should have_css("ol li", :count => 2)would not have been implemented already.