diff options
Diffstat (limited to 't/app/helpers/send_email.t')
-rw-r--r-- | t/app/helpers/send_email.t | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/t/app/helpers/send_email.t b/t/app/helpers/send_email.t index a44ddb01c..16e85b4ce 100644 --- a/t/app/helpers/send_email.t +++ b/t/app/helpers/send_email.t @@ -9,9 +9,10 @@ BEGIN { FixMyStreet->test_mode(1); } -use Test::More tests => 4; +use Test::More tests => 5; use Email::Send::Test; +use Path::Class; use_ok 'FixMyStreet::App'; my $c = FixMyStreet::App->new; @@ -20,7 +21,6 @@ my $c = FixMyStreet::App->new; $c->req->uri( URI->new('http://localhost/') ); $c->req->base( $c->req->uri ); - # set some values in the stash $c->stash->{foo} = 'bar'; @@ -34,19 +34,11 @@ ok $c->send_email( 'test', { to => 'test@recipient.com' } ), "sent an email"; my @emails = Email::Send::Test->emails; is scalar(@emails), 1, "caught one email"; -is $emails[0]->as_string, << 'END_OF_BODY', "email is as expected"; -Subject: test email -From: evdb@ecclestoad.co.uk -To: test@recipient.com -Content-Type: text/plain; charset="utf-8" - -Hello, - -This is a test email where foo: bar. - -utf8: 我们应该能够无缝处理UTF8编码 +# Get the email, check it has a date and then strip it out +my $email_as_string = $emails[0]->as_string; +ok $email_as_string =~ s{\s+Date:\s+\S.*?$}{}xms, "Found and stripped out date"; -Yours, - FixMyStreet. -END_OF_BODY +is $email_as_string, + file(__FILE__)->dir->file('send_email_sample.txt')->slurp, + "email is as expected"; |