btakita/rr — Issue #81: Equivalent of new_instance_of
Author: GerryG
Created: 2012-02-08 15:28:21+00:00
State: open

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.

any_instance_of(Mailer) do
mock(Mailer).account_info.with_any_args
end

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:

Mailer.should have_received.account_info(@juser, "Password Reset",
"You have been given a new temporary password. " +
"Please update your password once you've signed in. ")

I've tried to use instance_of as well with very similar results.

What am I missing?