aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/report_new.t
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2016-08-01 12:03:45 +0100
committerDave Arter <davea@mysociety.org>2016-08-01 12:03:45 +0100
commit1af9684e54aedb7f9935cdc4d38a28c61ec7d1f5 (patch)
treed6b044f54e070f8dbf265083534e849eb9ad6ead /t/app/controller/report_new.t
parent14aaf6fafaa9aa8736f49851e95fa2c3c566c056 (diff)
parent27e0c74321f48f9997745bf00647e3958f34d8e2 (diff)
Merge branch '1281-html-emails'
Diffstat (limited to 't/app/controller/report_new.t')
-rw-r--r--t/app/controller/report_new.t38
1 files changed, 15 insertions, 23 deletions
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t
index 2aebfa00b..6b4f40172 100644
--- a/t/app/controller/report_new.t
+++ b/t/app/controller/report_new.t
@@ -607,10 +607,9 @@ foreach my $test (
# receive token
my $email = $mech->get_email;
ok $email, "got an email";
- like $email->body, qr/confirm that you want to send your\s+report/i, "confirm the problem";
+ like $mech->get_text_body_from_email($email), qr/confirm that you want to send your\s+report/i, "confirm the problem";
- my ($url) = $email->body =~ m{(http://\S+)};
- ok $url, "extracted confirm url '$url'";
+ my $url = $mech->get_link_from_email($email);
# confirm token
$mech->get_ok($url);
@@ -949,10 +948,9 @@ subtest "test report creation for a category that is non public" => sub {
my $email = $mech->get_email;
ok $email, "got an email";
- like $email->body, qr/confirm that you want to send your\s+report/i, "confirm the problem";
+ like $mech->get_text_body_from_email($email), qr/confirm that you want to send your\s+report/i, "confirm the problem";
- my ($url) = $email->body =~ m{(http://\S+)};
- ok $url, "extracted confirm url '$url'";
+ my $url = $mech->get_link_from_email($email);
# confirm token
$mech->get_ok($url);
@@ -1145,10 +1143,9 @@ for my $test (
my $email = $mech->get_email;
ok $email, "got an email";
- like $email->body, qr/confirm that you want to send your\s+report/i, "confirm the problem";
+ like $mech->get_text_body_from_email($email), qr/confirm that you want to send your\s+report/i, "confirm the problem";
- my ($url) = $email->body =~ m{(https?://\S+)};
- ok $url, "extracted confirm url '$url'";
+ my $url = $mech->get_link_from_email($email);
# confirm token in order to update the user details
$mech->get_ok($url);
@@ -1315,17 +1312,17 @@ subtest "test Hart" => sub {
# receive token
my $email = $mech->get_email;
ok $email, "got an email";
- like $email->body, qr/to confirm that you want to send your/i, "confirm the problem";
+ my $body = $mech->get_text_body_from_email($email);
+ like $body, qr/to confirm that you want to send your/i, "confirm the problem";
# does it reference the fact that this report hasn't been sent to Hart?
if ( $test->{national} ) {
- like $email->body, qr/Hart Council is not responsible for this type/i, "mentions report hasn't gone to Hart";
+ like $body, qr/Hart Council is not responsible for this type/i, "mentions report hasn't gone to Hart";
} else {
- unlike $email->body, qr/Hart Council is not responsible for this type/i, "doesn't mention report hasn't gone to Hart";
+ unlike $body, qr/Hart Council is not responsible for this type/i, "doesn't mention report hasn't gone to Hart";
}
- my ($url) = $email->body =~ m{(http://\S+)};
- ok $url, "extracted confirm url '$url'";
+ my $url = $mech->get_link_from_email($email);
# confirm token
FixMyStreet::override_config {
@@ -1541,9 +1538,7 @@ subtest "unresponsive body handling works" => sub {
ok $report, "Found the report";
is $report->bodies_str, undef, "Report not going anywhere";
- my $email = $mech->get_email;
- ok $email, "got an email";
- like $email->body, qr/despite not being sent/i, "correct email sent";
+ like $mech->get_text_body_from_email, qr/despite not being sent/i, "correct email sent";
$user->problems->delete;
$mech->clear_emails_ok;
@@ -1577,9 +1572,7 @@ subtest "unresponsive body handling works" => sub {
ok $report, "Found the report";
is $report->bodies_str, undef, "Report not going anywhere";
- $email = $mech->get_email;
- ok $email, "got an email";
- like $email->body, qr/despite not being sent/i, "correct email sent";
+ like $mech->get_text_body_from_email, qr/despite not being sent/i, "correct email sent";
$user->problems->delete;
$mech->clear_emails_ok;
@@ -1737,10 +1730,9 @@ subtest "extra google analytics code displayed on email confirmation problem cre
my $email = $mech->get_email;
ok $email, "got an email";
- like $email->body, qr/confirm that you want to/i, "confirm the problem";
+ like $mech->get_text_body_from_email($email), qr/confirm that you want to/i, "confirm the problem";
- my ($url) = $email->body =~ m{(https?://\S+)};
- ok $url, "extracted confirm url '$url'";
+ my $url = $mech->get_link_from_email($email);
# confirm token in order to update the user details
$mech->get_ok($url);