diff --git a/lib/capybara/query.rb b/lib/capybara/query.rb index 73624e7ec..b07640383 100644 --- a/lib/capybara/query.rb +++ b/lib/capybara/query.rb @@ -39,6 +39,10 @@ def failure_message(type, node) message end + def negative_failure_message(type, node) + "expected #{description} not to return anything" + end + def name; selector.name; end def description diff --git a/lib/capybara/rspec/matchers.rb b/lib/capybara/rspec/matchers.rb index dccb2b6c1..9a2935347 100644 --- a/lib/capybara/rspec/matchers.rb +++ b/lib/capybara/rspec/matchers.rb @@ -20,7 +20,7 @@ def failure_message_for_should end def failure_message_for_should_not - "expected #{query.description} not to return anything" + query.negative_failure_message(:assert, @actual) end def description