4 BEGIN { $ENV{EMAIL_SENDER_TRANSPORT} = 'Test' }
7 'Catalyst::View::TT' => '0.31',
9 use Email::Sender::Simple;
11 use lib "$FindBin::Bin/lib";
13 use_ok('Catalyst::Test', 'TestApp');
17 ok( ( $response = request("/template_email?time=$time"))->is_success,
19 my @emails = Email::Sender::Simple->default_transport->deliveries;
20 like( $response->content, qr/Template Email Ok/, 'controller says ok' );
21 cmp_ok(@emails, '==', 1, 'got emails');
22 isa_ok( $emails[0]->{'email'}, 'Email::Abstract', 'email is ok' );
24 like($emails[0]->{'email'}[0]->header("Content-type"), qr#^multipart/alternative#, 'Multipart email');
26 my @parts = $emails[0]->{'email'}[0]->parts;
27 cmp_ok(@parts, '==', 2, 'got parts');
29 is($parts[0]->content_type, 'text/plain', 'text/plain part ok');
30 like($parts[0]->body, qr/test-email\@example.com on $time/, 'got content back');
32 is($parts[1]->content_type, 'text/html', 'text/html ok');
33 like($parts[1]->body, qr{<em>test-email\@example.com</em> on $time}, 'got content back');
34 #like($emails[0]->body, qr/$time/, 'Got our email');