aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2011-06-03 20:21:13 +0100
committerMatthew Somerville <matthew@mysociety.org>2011-06-03 20:21:13 +0100
commit5d2261eb81e9e28bbaa1f52c668be164bb7a597d (patch)
tree8144a0b47cff3fa3bc4a7dfd090d55162191174d /t/app/controller
parent5e3cc91d5c7cb3c48418cf26064de2ba214e6567 (diff)
Sign up new report to email alert if logged in as well as when confirmed by email. Allow disabling rather than deleting of alerts. Revert quoting as it breaks timestamps and literal SQL.
Diffstat (limited to 't/app/controller')
-rw-r--r--t/app/controller/report_new.t17
1 files changed, 16 insertions, 1 deletions
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t
index 760dfacc6..01c29ecf4 100644
--- a/t/app/controller/report_new.t
+++ b/t/app/controller/report_new.t
@@ -343,10 +343,17 @@ subtest "test report creation for a user who does not have an account" => sub {
$mech->get_ok($url);
$report->discard_changes;
is $report->state, 'confirmed', "Report is now confirmed";
- is $report->state, 'confirmed', "report is now confirmed";
$mech->get_ok( '/report/' . $report->id );
+ # check that the reporter has an alert
+ my $alert = FixMyStreet::App->model('DB::Alert')->find( {
+ user => $report->user,
+ alert_type => 'new_updates',
+ parameter => $report->id,
+ } );
+ ok $alert, "created new alert";
+
# user is created and logged in
$mech->logged_in_ok;
@@ -440,6 +447,14 @@ foreach my $test (
is $report->state, 'confirmed', "report is now confirmed";
$mech->get_ok( '/report/' . $report->id );
+ # check that the reporter has an alert
+ my $alert = FixMyStreet::App->model('DB::Alert')->find( {
+ user => $report->user,
+ alert_type => 'new_updates',
+ parameter => $report->id,
+ } );
+ ok $alert, "created new alert";
+
# user is still logged in
$mech->logged_in_ok;