diff --git a/lib/rspec/matchers/dsl.rb b/lib/rspec/matchers/dsl.rb index bf4189e4d..f1b43fc14 100644 --- a/lib/rspec/matchers/dsl.rb +++ b/lib/rspec/matchers/dsl.rb @@ -537,12 +537,12 @@ def override_custom_matcher_method(klass, name) end def check_method_call_count - if (@call_count -= 1) > 0 - RSpec.warning( - "The custom matcher `#{name}` or its negated method is called " \ + return if (@call_count -= 1) == 0 + + RSpec.warning( + "The custom matcher `#{name}` or its negated method is called " \ 'more than once in the test expectations without using `and` or `or`' - ) - end + ) end def actual_arg_for(block)