I am stubbing a method like this in the setup of one of my tests
def setup
super
#blah, blah
GoogleIdentity.stubs(:new).with(google_identity).returns(google_account)
end
The problem is that not every test will invoke the method and return the object.
In the methods that do not invoke the method, I get this error:
allowed any number of times, not yet invoked: GoogleIdentity.new()
It seems like mocha is complaining because the method was not invoked.
How can I specify a stub that does not expect it to be calle?