Given a class which has matching instance and class methods, if a test incorrectly calls Mocktail.of_next instead of Mocktail.replace then tries to demonstrate a call to the method, this error is raised:
`stubs` & `verify` expect exactly one invocation of a mocked method, but 2 were detected.
As a result, Mocktail doesn't know which invocation to stub or verify.
(Mocktail::AmbiguousDemonstrationError)
I'd expect there to be 0 invocations detected, but even better I'd love to be told that I'm not demonstrating using anything that's been mocked yet.
Here's a basic reproduction:
ambiguous.rb:
require "mocktail"
class Fighter
def self.weapon
new.weapon
end
def weapon
"sword"
end
end
Mocktail.of_next(Fighter)
Mocktail.stubs { Fighter.weapon }.with { nil }
$ ruby ambiguous.rb