[rspec-users] "Tricks" for testing after_create callback???

Rick DeNatale rick.denatale at gmail.com
Thu Dec 13 08:43:59 EST 2007

On 12/13/07, Daniel Tenner <daniel.ruby at tenner.org> wrote:
> Hi Rick,
> I'm probably a heretic on this point, but I would test
> that :deliver_xyz is being called but not specify what parameters
> it's called with.
> What's my reasoning?
> - What I'm really testing in the Message spec is not the validity of
> the email that's being sent, but the fact that an email is being
> sent. Basically, I think the Mailer is a different tier.

I'm not testing the validity of the email, but.

In this case the email which gets send depends largely on what's in
the message object.  The mailer extracts attributes from the object to
create the email, so it's crucial that the correct message is passed
and that's what I'm trying to spec.

The actual contents of the message are specified in tests against the
mailer as I indicated in my earlier reply to Pat.

Rick DeNatale

My blog on Ruby

More information about the rspec-users mailing list