06confit.t now passes. may/may not want to remove the config shit from the test model
Devin Austin [Sat, 9 Jan 2010 00:37:39 +0000 (00:37 +0000)]
t/06config.t
t/lib/TestApp.pm
t/lib/TestApp/View/Email/AppConfig.pm
t/lib/TestApp/View/Email/Template/AppConfig.pm

index 871e35d..5dee491 100644 (file)
@@ -1,8 +1,9 @@
 use strict;
 use warnings;
-use Test::More tests => 13;
+BEGIN { $ENV{EMAIL_SENDER_TRANSPORT} = 'Test' }
 
-use Email::Send::Test;
+use Test::More; 
+use Email::Sender::Simple;
 use FindBin;
 use lib "$FindBin::Bin/lib";
 
@@ -16,26 +17,26 @@ $time = time;
 
 ok( ($response = request("/email_app_config?time=$time"))->is_success, 'request ok');
 
-@emails = Email::Send::Test->emails;
+@emails = Email::Sender::Simple->default_transport->deliveries;
 
-is(@emails, 1, "got emails");
-isa_ok( $emails[0], 'Email::MIME', 'email is ok' );
-like($emails[0]->body, qr/$time/, 'Got our email');
+is(scalar @emails, 1, "got emails");
+isa_ok( $emails[0]->{'email'}, 'Email::Abstract', 'email is ok' );
+like($emails[0]->{'email'}->[0]->body, qr/$time/, 'Got our email');
 
-Email::Send::Test->clear;
+Email::Sender::Simple->default_transport->clear_deliveries;
 
 $time = time;
 ok( ($response = request("/template_email_app_config?time=$time"))->is_success, 'request ok');
 
-@emails = Email::Send::Test->emails;
+@emails = Email::Sender::Simple->default_transport->deliveries;
 
-is(@emails, 1, "got emails");
-isa_ok( $emails[0], 'Email::MIME', 'email is ok' );
-my @parts = $emails[0]->parts;
+is(scalar @emails, 1, "got emails");
+isa_ok( $emails[0]->{'email'}, 'Email::Abstract', 'email is ok' );
+my @parts = $emails[0]->{'email'}[0]->parts;
 cmp_ok(@parts, '==', 2, 'got parts');
 
 is($parts[0]->content_type, 'text/plain', 'text/plain 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{<em>test-email\@example.com</em> on $time}, 'got content back');
-
+done_testing();
index 8d2a831..8412eb2 100644 (file)
@@ -17,6 +17,7 @@ TestApp->config(
         sender => {
             mailer => 'Test',
         },
+               content_type => 'text/html',
         default => {
             view => 'TT',
         },
index fd9e9a8..cecacbb 100644 (file)
@@ -1,7 +1,7 @@
 package # Hide from PAUSE
     TestApp::View::Email::AppConfig;
 
-use Email::Send::Test;
+use Email::Sender::Simple;
 
 use base 'Catalyst::View::Email';
 
index 487905e..90657b3 100644 (file)
@@ -1,7 +1,7 @@
 package # Hide from PAUSE
     TestApp::View::Email::Template::AppConfig;
 
-use Email::Send::Test;
+use Email::Sender::Simple;
 
 use base 'Catalyst::View::Email::Template';