Closed GerryG closed 12 years ago
You may have figured this out by now but
What is confusing here relates to how Mailer works. The class gets called, and it creates a new object and calls the same method on the new object. In your own mailer class (Mailer for me), you declare these methods as instance methods.
On the other hand, my example doesn't seem exactly right. There should be an object passed to the block and that is what I wanted mocked.
Now I'm trying to figure out whether it matters if I spy on the class or the created instances.
Thanks anyway.
I can't seem to figure out how this is supposed to be done. I've tried many things, and I can't get it to record the calls (spy), on new instances of my Mailer class (from ActionMailer::Base).
This first part seems to work, although I'm not clear on the documentation that indicates any_instance_of doesn't work the same for mocks as stubs. It seems that declaring the expectation, I should get the method calls recorded.
This part always fails. I've been able to make it work with 1.8.7 and patching up rr-1.0.0 which still has that method:
I've tried to use instance_of as well with very similar results.
What am I missing?