missing commas
[catagits/Catalyst-View-Email.git] / t / 07mason.t
1 use strict;
2 use warnings;
3 use Test::More;
4
5 use Email::Send::Test;
6 use FindBin;
7 use lib "$FindBin::Bin/lib";
8
9 eval "use Catalyst::View::Mason";
10 if ( $@ ) {
11     plan skip_all => 'Catalyst::View::Mason required for Mason tests';
12     exit;
13 }
14 plan tests => 10;
15
16 use_ok('Catalyst::Test', 'TestApp');
17
18 TestApp->config->{default_view} = 'Mason';
19
20 my $response;
21 my $time = time;
22 ok( ( $response = request("/mason_email?time=$time"))->is_success,
23     'request ok' );
24 like( $response->content, qr/Mason Email Ok/, 'controller says ok' );
25 my @emails = Email::Send::Test->emails;
26
27 cmp_ok(@emails, '==', 1, 'got emails');
28 isa_ok( $emails[0], 'Email::MIME', 'email is ok' );
29 my @parts = $emails[0]->parts;
30 cmp_ok(@parts, '==', 2, 'got parts');
31
32 is($parts[0]->content_type, 'text/plain', 'text/plain ok');
33 like($parts[0]->body, qr/test-email\@example.com on $time/, 'got content back');
34 is($parts[1]->content_type, 'text/html', 'text/html ok');
35 like($parts[1]->body, qr{<em>test-email\@example.com</em> on $time}, 'got content back');
36 #like($emails[0]->body, qr/$time/, 'Got our email');
37