1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Output the number of matches that were expected if called with the count option

This commit is contained in:
Jordan Elver 2011-12-01 17:14:51 +00:00
parent 013151004b
commit 962e160f4d
2 changed files with 3 additions and 1 deletions

View file

@ -77,6 +77,8 @@ module Capybara
def failure_message_for_should
if failure_message
failure_message.call(actual, self)
elsif(@options[:count])
"expected #{selector_name} to be returned #{@options[:count]} times"
else
"expected #{selector_name} to return something"
end

View file

@ -32,7 +32,7 @@ describe Capybara::RSpecMatchers do
it "fails if matched node count does not equal expected count" do
expect do
"<h1>Text</h1>".should have_css('h1', :count => 2)
end.to raise_error(/expected css "h1" to return something/)
end.to raise_error(/expected css "h1" to be returned 2 times/)
end
end