[rspec-users] How To Mock A Chain (specifically ActionMailerModel.method.deliver)
jack.kinsella at gmail.com
Wed Nov 17 13:49:32 EST 2010
In Rails 3 you deliver a mail message with the
ActionMailerModel.method.deliver syntax (e.g.
Notifier.welcome_message.deliver). How do you test that this method is
called in Rspec. I'm looking for an equivalent to "stub_chain" which
has expectations. I'm testing that messages are sent on certain events
in the object life cycle (e.g. that an email is sent when an Award is
I know it's possible to abstract welcome_message.deliver into a single
method call, but this seems overly inconvenient for such a simple
Anyone any ideas on how to solve this problem?
More information about the rspec-users