aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/model
diff options
context:
space:
mode:
Diffstat (limited to 't/app/model')
-rw-r--r--t/app/model/alert_type.t65
1 files changed, 15 insertions, 50 deletions
diff --git a/t/app/model/alert_type.t b/t/app/model/alert_type.t
index 272ad4900..7df4c44c0 100644
--- a/t/app/model/alert_type.t
+++ b/t/app/model/alert_type.t
@@ -155,59 +155,24 @@ my $council_alert = FixMyStreet::App->model('DB::Alert')->find_or_create(
}
);
-for my $test (
- {
- postcode => 'SW1A 1AA',
- expected_postcode => 'SW1A 1AA',
- },
- {
- postcode => 'sw1a 1AA',
- expected_postcode => 'SW1A 1AA',
- },
- {
- postcode => 'SW1A 1aa',
- expected_postcode => 'SW1A 1AA',
- },
- {
- postcode => 'SW1A1AA',
- expected_postcode => 'SW1A 1AA',
- },
- {
- postcode => 'Buckingham Gate',
- expected_postcode => 'Buckingham\s+Gate',
- },
- {
- postcode => 'Buckingham gate',
- expected_postcode => 'Buckingham\s+gate',
- },
-) {
- subtest "correct text for postcode $test->{postcode}" => sub {
- $mech->clear_emails_ok;
-
- my $sent = FixMyStreet::App->model('DB::AlertSent')->search(
- {
- alert_id => $council_alert->id,
- parameter => $report->id,
- }
- )->delete;
-
- $report->postcode( $test->{postcode} );
- $report->update;
-
- FixMyStreet::App->model('DB::AlertType')->email_alerts();
+subtest "correct text for title after URL" => sub {
+ $mech->clear_emails_ok;
- $mech->email_count_is( 1 );
- my $email = $mech->get_email;
- my $pc = $test->{expected_postcode};
- (my $title = $report->title) =~ s/ /\\s+/;
- my $body = $email->body;
+ my $sent = FixMyStreet::App->model('DB::AlertSent')->search(
+ {
+ alert_id => $council_alert->id,
+ parameter => $report->id,
+ }
+ )->delete;
+ FixMyStreet::App->model('DB::AlertType')->email_alerts();
- like $body, qr#report/$report_id\s+-\s+$title,\s+$pc#, 'email contains expected postcode';
- };
-}
+ $mech->email_count_is( 1 );
+ my $email = $mech->get_email;
+ (my $title = $report->title) =~ s/ /\\s+/;
+ my $body = $email->body;
-$report->postcode( 'SW1A 1AA' );
-$report->update;
+ like $body, qr#report/$report_id\s+-\s+$title#, 'email contains expected title';
+};
$report->geocode(
{