[Catalyst] C::P::Email and testing

Perrin Harkins perrin at elem.com
Mon Dec 18 02:08:46 GMT 2006


Daniel McBrearty wrote:
> if you have an action that sends an email, how do you write tests for it?

We do it by subclassing Net::SMTP::Server to write all mail to files in 
a temp directory.  Then we send the mail to it and check the contents in 
the temp file.  That way the whole code path gets executed and we don't 
depend on the local machine having working SMTP and IMAP servers.

- Perrin



More information about the Catalyst mailing list