aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/helpers/send_email.t
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2019-11-27 20:15:33 +0000
committerMatthew Somerville <matthew@mysociety.org>2019-12-09 09:38:03 +0000
commit2e9e82dfb57b972d1351ecef86687a0d067598b1 (patch)
tree189119d0c2be5b0327855609d27cb745a3d14d7b /t/app/helpers/send_email.t
parent6c2d3d5a7d84521d34daa2cf7e4be76a54b3b0e0 (diff)
Switch to default-escaped in email templates.
We add a way to process a template with no auto-escaping, that can be used for the text parts of emails, and mark various HTML output as safe.
Diffstat (limited to 't/app/helpers/send_email.t')
-rw-r--r--t/app/helpers/send_email.t10
1 files changed, 9 insertions, 1 deletions
diff --git a/t/app/helpers/send_email.t b/t/app/helpers/send_email.t
index 58b9acaaa..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;
@@ -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 &lt;b&gt;bold&lt;\/b&gt;/;
+ }
+ });
$mech->clear_emails_ok;
};