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

Sébastien Wagener sebastien.wagener at gmail.com
Sat Dec 16 09:08:08 GMT 2006


On Sat, 2006-12-16 at 07:45 +0100, Daniel McBrearty wrote:
> if you have an action that sends an email, how do you write tests for it?
> 
> perhaps print the email to a temp file in test mode? what do you guys do?
> 
I am currently considering writing tests for my e-mails too. 
You could set __PACKAGE__->config->{email} to "Test" if some env
variable is set, and dump Email::Send::Test->emails to a file in an end
action. Or you could provide a testing action to display (and clear) the
sent e-mails. 
I have a similar problem with the values of my captchas. 
Btw.: Are there any best practices to hide an action unless in testing
mode? Protect it by an ACL rule if an environment variable is set?

Sébastien




More information about the Catalyst mailing list