Skip to content

Commit

Permalink
inline on_stubbing_method_unnecessarily used only once
Browse files Browse the repository at this point in the history
  • Loading branch information
nitishr committed Dec 26, 2019
1 parent ba795d6 commit acadb30
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 @@ -81,7 +81,9 @@ def verify(assertion_counter = nil)
raise ExpectationErrorFactory.build("not all expectations were satisfied\n#{mocha_inspect}", backtrace)
end
unless Mocha.configuration.stubbing_method_unnecessarily == :allow
expectations.reject(&:used?).each { |e| on_stubbing_method_unnecessarily(e) }
expectations.reject(&:used?).each do |e|
check(:stubbing_method_unnecessarily, 'method unnecessarily', e.method_signature, e.backtrace)
end
end
end

Expand Down Expand Up @@ -123,10 +125,6 @@ def on_stubbing(object, method)
check(:stubbing_method_on_non_mock_object, 'method on non-mock object', method_signature)
end

def on_stubbing_method_unnecessarily(expectation)
check(:stubbing_method_unnecessarily, 'method unnecessarily', expectation.method_signature, expectation.backtrace)
end

attr_writer :logger

def logger
Expand Down

0 comments on commit acadb30

Please sign in to comment.