missing commas
[catagits/Catalyst-View-Email.git] / t / 06config.t
CommitLineData
c18b93ec 1use strict;
2use warnings;
8b10ee55 3use Test::More tests => 13;
c18b93ec 4
5use Email::Send::Test;
6use FindBin;
7use lib "$FindBin::Bin/lib";
8
9use_ok('Catalyst::Test', 'TestApp');
10
11my $response;
8b10ee55 12my $time;
13my @emails;
14
15$time = time;
16
c18b93ec 17ok( ($response = request("/email_app_config?time=$time"))->is_success, 'request ok');
18
8b10ee55 19@emails = Email::Send::Test->emails;
c18b93ec 20
21is(@emails, 1, "got emails");
22isa_ok( $emails[0], 'Email::MIME', 'email is ok' );
23like($emails[0]->body, qr/$time/, 'Got our email');
8b10ee55 24
25Email::Send::Test->clear;
26
27$time = time;
28ok( ($response = request("/template_email_app_config?time=$time"))->is_success, 'request ok');
29
30@emails = Email::Send::Test->emails;
31
32is(@emails, 1, "got emails");
33isa_ok( $emails[0], 'Email::MIME', 'email is ok' );
34my @parts = $emails[0]->parts;
35cmp_ok(@parts, '==', 2, 'got parts');
36
28151039 37is($parts[0]->content_type, 'text/plain', 'text/plain ok');
8b10ee55 38like($parts[0]->body, qr/test-email\@example.com on $time/, 'got content back');
28151039 39is($parts[1]->content_type, 'text/html', 'text/html ok');
8b10ee55 40like($parts[1]->body, qr{<em>test-email\@example.com</em> on $time}, 'got content back');
41