From 759582680c1cbb5655833b6aaf8b3c580f6ce4b9 Mon Sep 17 00:00:00 2001 From: Nitish Rathi Date: Wed, 25 Dec 2019 23:54:48 +0000 Subject: [PATCH] remove unless stubbing_method_unnecessarily allow check ... the check is redundant as the check method already returns early/does nothing if the action is allowed --- lib/mocha/mockery.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/mocha/mockery.rb b/lib/mocha/mockery.rb index 5e628c296..8ed8628d1 100644 --- a/lib/mocha/mockery.rb +++ b/lib/mocha/mockery.rb @@ -80,10 +80,8 @@ def verify(assertion_counter = nil) backtrace = unsatisfied_expectations.empty? ? caller : unsatisfied_expectations[0].backtrace raise ExpectationErrorFactory.build("not all expectations were satisfied\n#{mocha_inspect}", backtrace) end - unless Mocha.configuration.stubbing_method_unnecessarily == :allow - expectations.reject(&:used?).each do |e| - check(:stubbing_method_unnecessarily, 'method unnecessarily', e.method_signature, e.backtrace) - end + expectations.reject(&:used?).each do |e| + check(:stubbing_method_unnecessarily, 'method unnecessarily', e.method_signature, e.backtrace) end end