# File lib/mocha/mockery.rb, line 85 def verify(assertion_counter = nil) unless mocks.all? { |mock| mock.__verified__?(assertion_counter) } message = "not all expectations were satisfied\n#{mocha_inspect}" backtrace = if unsatisfied_expectations.empty? caller else unsatisfied_expectations[0].backtrace end raise ExpectationErrorFactory.build(message, backtrace) end expectations.each do |e| unless Mocha::Configuration.allow?(:stubbing_method_unnecessarily) next if e.used? on_stubbing_method_unnecessarily(e) end end end