Adding the stash tthe render call of TT. Right now this requires TT, but will change...
[catagits/Catalyst-View-Email.git] / t / 05template.t
CommitLineData
82300460 1use strict;
2use warnings;
3use Test::More tests => 5;
4
5use Email::Send::Test;
6use FindBin;
7use lib "$FindBin::Bin/lib";
8
9use_ok('Catalyst::Test', 'TestApp');
10
11my $response;
12my $time = time;
13ok( ( $response = request("/template_email?time=$time"))->is_success,
14 'request ok' );
15like( $response->content, qr/Template Email Ok/, 'controller says ok' );
16my @emails = Email::Send::Test->emails;
17
18cmp_ok(@emails, '==', 1, 'got emails');
19isa_ok( $emails[0], 'Email::MIME', 'email is ok' );
20my @parts = $emails[0]->parts;
21cmp_ok(@parts, '==', 2, 'got parts');
22
23is($parts[0]->content_type, 'text/plain; charset="us-ascii"', 'text/plain ok');
24like($parts[0]->body, qr/jshirley\@picturetrail.com on $time/, 'got content back');
25is($parts[1]->content_type, 'text/html; charset="us-ascii"', 'text/html ok');
26like($parts[1]->body, qr{<em>jshirley\@picturetrail.com</em> on $time}, 'got content back');
27#like($emails[0]->body, qr/$time/, 'Got our email');
28