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