diff options
author | Matthew Somerville <matthew@mysociety.org> | 2011-07-16 08:31:08 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2011-07-16 08:34:33 +0100 |
commit | 327ac51aec0f0625fcb79179c0e1c5eec928223d (patch) | |
tree | 18b8e3d65272c87912f5409e4b4ea4f1397ec84b /t/app | |
parent | 3659557ee50eb9eb00f14825970994e2a8072b89 (diff) |
Don't use update name if marked as anonymous.
Diffstat (limited to 't/app')
-rw-r--r-- | t/app/controller/alert_new.t | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/t/app/controller/alert_new.t b/t/app/controller/alert_new.t index cb3b4b656..580a5ad9a 100644 --- a/t/app/controller/alert_new.t +++ b/t/app/controller/alert_new.t @@ -431,6 +431,19 @@ subtest "Test normal alert signups and that alerts are sent" => sub { my $update_id = $update->id; ok $update, "created test update - $update_id"; + $update = FixMyStreet::App->model('DB::Comment')->create( { + problem_id => $report_id, + user_id => $user2->id, + name => 'Anonymous User', + mark_fixed => 'false', + text => 'This is some more update text', + state => 'confirmed', + confirmed => $dt->clone->add( hours => 8 ), + anonymous => 't', + } ); + $update_id = $update->id; + ok $update, "created test update - $update_id"; + FixMyStreet::App->model('DB::AlertType')->email_alerts(); $mech->email_count_is(3); my @emails = $mech->get_email; @@ -442,6 +455,10 @@ subtest "Test normal alert signups and that alerts are sent" => sub { } is $count, 3, 'Three emails with the right things in them'; + my $email = $emails[0]; + like $email->body, qr/Other User/, 'Update name given'; + unlike $email->body, qr/Anonymous User/, 'Update name not given'; + my ( $url, $url_token ) = $emails[0]->body =~ m{http://\S+(/A/(\S+))}; $mech->get_ok( $url ); $mech->content_contains('successfully deleted'); |