diff options
Diffstat (limited to 't/app/helpers')
-rw-r--r-- | t/app/helpers/send_email.t | 12 | ||||
-rw-r--r-- | t/app/helpers/send_email_sample.txt | 2 | ||||
-rw-r--r-- | t/app/helpers/send_email_sample_mime.txt | 2 |
3 files changed, 12 insertions, 4 deletions
diff --git a/t/app/helpers/send_email.t b/t/app/helpers/send_email.t index a692fb6bc..522ee39d0 100644 --- a/t/app/helpers/send_email.t +++ b/t/app/helpers/send_email.t @@ -17,7 +17,7 @@ my $mech = FixMyStreet::TestMech->new; my $c = ctx_request("/"); # set some values in the stash -$c->stash->{foo} = 'bar'; +$c->stash->{foo} = 'bar <b>bold</b>'; # clear the email queue $mech->clear_emails_ok; @@ -40,7 +40,7 @@ my $email = Email::MIME->new($email_as_string); my $expected_email_content = path(__FILE__)->parent->child('send_email_sample.txt')->slurp; my $name = FixMyStreet->config('CONTACT_NAME'); -my $sender = '"' . $name . '" <' . FixMyStreet->config('DO_NOT_REPLY_EMAIL') . '>'; +my $sender = $name . ' <' . FixMyStreet->config('DO_NOT_REPLY_EMAIL') . '>'; $expected_email_content =~ s{CONTACT_EMAIL}{$sender}; my $expected_email = Email::MIME->new($expected_email_content); @@ -118,6 +118,14 @@ subtest 'Inline emails!' => sub { \ {10}\+\ text/plain.*\n \ {10}\+\ text/html.*\n \ {5}\+\ image/gif]x; + $email->walk_parts(sub { + my ($part) = @_; + if ($part->content_type =~ m[text/plain]i) { + like $part->body_str, qr/foo: bar <b>bold<\/b>/; + } elsif ($part->content_type =~ m[text/html]i) { + like $part->body_str, qr/foo: bar <b>bold<\/b>/; + } + }); $mech->clear_emails_ok; }; diff --git a/t/app/helpers/send_email_sample.txt b/t/app/helpers/send_email_sample.txt index 68fe61f0e..e14c536be 100644 --- a/t/app/helpers/send_email_sample.txt +++ b/t/app/helpers/send_email_sample.txt @@ -7,7 +7,7 @@ From: CONTACT_EMAIL Hello, -This is a test email where foo: bar. +This is a test email where foo: bar <b>bold</b>. utf8: =E6=88=91=E4=BB=AC=E5=BA=94=E8=AF=A5=E8=83=BD=E5=A4=9F=E6=97=A0=E7=BC= =9D=E5=A4=84=E7=90=86UTF8=E7=BC=96=E7=A0=81 diff --git a/t/app/helpers/send_email_sample_mime.txt b/t/app/helpers/send_email_sample_mime.txt index 7b4ce91f6..623874149 100644 --- a/t/app/helpers/send_email_sample_mime.txt +++ b/t/app/helpers/send_email_sample_mime.txt @@ -12,7 +12,7 @@ Content-Transfer-Encoding: quoted-printable Hello,
-This is a test email where foo: bar.
+This is a test email where foo: bar <b>bold</b>.
utf8: =E6=88=91=E4=BB=AC=E5=BA=94=E8=AF=A5=E8=83=BD=E5=A4=9F=E6=97=A0=E7=BC=
=9D=E5=A4=84=E7=90=86UTF8=E7=BC=96=E7=A0=81
|