aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/alert_new.t
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-05-11 14:55:39 +0100
committerStruan Donald <struan@exo.org.uk>2011-05-11 14:55:39 +0100
commitc3adef1dea602a181521f2bc0848ec47d67198d0 (patch)
treee65bb2ac57e92d8501dff147516855c4853ac873 /t/app/controller/alert_new.t
parenta20a64f50fa01c7e3604c5dc329db2c4a607682d (diff)
moving alerts to use users instead of email in table
Diffstat (limited to 't/app/controller/alert_new.t')
-rw-r--r--t/app/controller/alert_new.t29
1 files changed, 23 insertions, 6 deletions
diff --git a/t/app/controller/alert_new.t b/t/app/controller/alert_new.t
index 94a4229ff..0b4cacfdc 100644
--- a/t/app/controller/alert_new.t
+++ b/t/app/controller/alert_new.t
@@ -53,21 +53,38 @@ foreach my $test (
my $type = $test->{type} . '_problems';
- # we don't want an alert
- my $alert = FixMyStreet::App->model('DB::Alert')->find(
+ my $user = FixMyStreet::App->model('DB::User')->find(
{
- email => $test->{email},
- alert_type => $type
+ email => $test->{email}
}
);
+
+ # we don't want an alert
+ my $alert;
+ if ( $user ) {
+ $alert = FixMyStreet::App->model('DB::Alert')->find(
+ {
+ user => $user,
+ alert_type => $type
+ }
+ );
+ }
$alert->delete() if $alert;
$mech->get_ok( $test->{uri} );
$mech->content_contains( $test->{content} );
+ $user = FixMyStreet::App->model('DB::User')->find(
+ {
+ email => $test->{email}
+ }
+ );
+
+ ok $user, 'user for report';
+
$alert = FixMyStreet::App->model('DB::Alert')->find(
{
- email => $test->{email},
+ user => $user,
alert_type => $type,
parameter => $test->{param1},
parameter2 => $test->{param2},
@@ -117,7 +134,7 @@ foreach my $test (
ok $token->data->{id} == $existing_id, 'subscribed to exsiting alert';
$mech->get_ok("/A/$url_token");
- $mech->content_contains('subscribed');
+ $mech->content_contains('successfully confirmed');
$alert =
FixMyStreet::App->model('DB::Alert')->find( { id => $existing_id, } );