From 3c736f14160ae079f2391ee6340feb8efc588f8d Mon Sep 17 00:00:00 2001 From: AlecksJohannes Date: Sun, 13 Aug 2023 22:01:43 +0700 Subject: [PATCH] Refactor --- lib/rspec/matchers/dsl.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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)