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:
parent
013151004b
commit
962e160f4d
2 changed files with 3 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue