From c7db3f67e556f6784ae72fbd154edbc71e94d9a0 Mon Sep 17 00:00:00 2001 From: Nitish Rathi Date: Wed, 25 Dec 2019 23:54:48 +0000 Subject: [PATCH] Remove redundant stubbing_method_unnecessarily conditional The `if` statement is redundant, because the Mockery#check method already returns early/does nothing if the action is allowed. --- lib/mocha/mockery.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/mocha/mockery.rb b/lib/mocha/mockery.rb index 8b245ec4e..64799c7d9 100644 --- a/lib/mocha/mockery.rb +++ b/lib/mocha/mockery.rb @@ -86,11 +86,9 @@ def verify(assertion_counter = nil) end raise ExpectationErrorFactory.build(message, backtrace) end - unless Mocha.configuration.stubbing_method_unnecessarily == :allow - expectations.reject(&:used?).each do |expectation| - signature_proc = lambda { expectation.method_signature } - check(:stubbing_method_unnecessarily, 'method unnecessarily', signature_proc, expectation.backtrace) - end + expectations.reject(&:used?).each do |expectation| + signature_proc = lambda { expectation.method_signature } + check(:stubbing_method_unnecessarily, 'method unnecessarily', signature_proc, expectation.backtrace) end end