Commit | Line | Data |
82300460 |
1 | use strict; |
2 | use warnings; |
fd0033bc |
3 | use Test::More tests => 10; |
82300460 |
4 | |
5 | use Email::Send::Test; |
6 | use FindBin; |
7 | use lib "$FindBin::Bin/lib"; |
8 | |
9 | use_ok('Catalyst::Test', 'TestApp'); |
10 | |
11 | my $response; |
12 | my $time = time; |
13 | ok( ( $response = request("/template_email?time=$time"))->is_success, |
14 | 'request ok' ); |
15 | like( $response->content, qr/Template Email Ok/, 'controller says ok' ); |
16 | my @emails = Email::Send::Test->emails; |
17 | |
18 | cmp_ok(@emails, '==', 1, 'got emails'); |
19 | isa_ok( $emails[0], 'Email::MIME', 'email is ok' ); |
20 | my @parts = $emails[0]->parts; |
21 | cmp_ok(@parts, '==', 2, 'got parts'); |
22 | |
23 | is($parts[0]->content_type, 'text/plain; charset="us-ascii"', 'text/plain ok'); |
fd0033bc |
24 | like($parts[0]->body, qr/test-email\@example.com on $time/, 'got content back'); |
82300460 |
25 | is($parts[1]->content_type, 'text/html; charset="us-ascii"', 'text/html ok'); |
fd0033bc |
26 | like($parts[1]->body, qr{<em>test-email\@example.com</em> on $time}, 'got content back'); |
82300460 |
27 | #like($emails[0]->body, qr/$time/, 'Got our email'); |
28 | |