X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F05template.t;h=ab5abe4ea4822a2662ebf3aa3bd02aa041ae3ada;hb=502b560653fd758241e2b597ac0849745704365c;hp=f6676d82c0a7ad5b6e242f44bb0afdbb33960ad6;hpb=82300460e4966b57774111e8e3b293079acbafdc;p=catagits%2FCatalyst-View-Email.git
diff --git a/t/05template.t b/t/05template.t
index f6676d8..ab5abe4 100644
--- a/t/05template.t
+++ b/t/05template.t
@@ -1,28 +1,39 @@
use strict;
use warnings;
-use Test::More tests => 5;
-use Email::Send::Test;
+BEGIN { $ENV{EMAIL_SENDER_TRANSPORT} = 'Test' }
+use Test::More;
+
+use Email::Sender::Simple;
use FindBin;
use lib "$FindBin::Bin/lib";
+eval "use Catalyst::View::TT";
+if ( $@ ) {
+ plan skip_all => 'Catalyst::View::TT required for Template tests';
+ exit;
+}
+
use_ok('Catalyst::Test', 'TestApp');
my $response;
my $time = time;
ok( ( $response = request("/template_email?time=$time"))->is_success,
'request ok' );
+my @emails = Email::Sender::Simple->default_transport->deliveries;
like( $response->content, qr/Template Email Ok/, 'controller says ok' );
-my @emails = Email::Send::Test->emails;
-
cmp_ok(@emails, '==', 1, 'got emails');
-isa_ok( $emails[0], 'Email::MIME', 'email is ok' );
-my @parts = $emails[0]->parts;
+isa_ok( $emails[0]->{'email'}, 'Email::Abstract', 'email is ok' );
+
+like($emails[0]->{'email'}[0]->header("Content-type"), qr#^multipart/alternative#, 'Multipart email');
+
+my @parts = $emails[0]->{'email'}[0]->parts;
cmp_ok(@parts, '==', 2, 'got parts');
-is($parts[0]->content_type, 'text/plain; charset="us-ascii"', 'text/plain ok');
-like($parts[0]->body, qr/jshirley\@picturetrail.com on $time/, 'got content back');
-is($parts[1]->content_type, 'text/html; charset="us-ascii"', 'text/html ok');
-like($parts[1]->body, qr{jshirley\@picturetrail.com on $time}, 'got content back');
-#like($emails[0]->body, qr/$time/, 'Got our email');
+is($parts[0]->content_type, 'text/plain', 'text/plain part ok');
+like($parts[0]->body, qr/test-email\@example.com on $time/, 'got content back');
+is($parts[1]->content_type, 'text/html', 'text/html ok');
+like($parts[1]->body, qr{test-email\@example.com on $time}, 'got content back');
+#like($emails[0]->body, qr/$time/, 'Got our email');
+done_testing();