Skip to content

Commit

Permalink
Remove redundant stubbing_method_unnecessarily conditional
Browse files Browse the repository at this point in the history
The `if` statement is redundant, because the Mockery#check method
already returns early/does nothing if the action is allowed.
  • Loading branch information
nitishr authored and floehopper committed Feb 10, 2020
1 parent 0532ada commit c7db3f6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/mocha/mockery.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit c7db3f6

Please sign in to comment.