Merge pull request #556 from jordelver/show-number-of-items-expected

Output the number of matches that were expected if called with the count option
This commit is contained in:
Jonas Nicklas 2011-12-01 23:08:45 -08:00
commit a905d9f418
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