aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/report_display.t
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2014-12-11 16:42:53 +0000
committerMatthew Somerville <matthew@mysociety.org>2014-12-12 12:41:31 +0000
commit43c98742ee85c73c4783451ceeea28108bb793c6 (patch)
tree40ced5bfa4a7b6c0328da62f8332cdc06a6637ea /t/app/controller/report_display.t
parent4edc79829ebf2f6dcce11185e929a2a592a3f5ed (diff)
By default, use area-based alerts.
The body-based alert only works if the body ID matches the MapIt ID. This fixes #959. Further work needs to be done to enable proper body-based alerts that work properly in all circumstances. Consequently, factor out fixed body IDs from many tests. Also fix a couple of tests not overriding geocoder correctly.
Diffstat (limited to 't/app/controller/report_display.t')
-rw-r--r--t/app/controller/report_display.t29
1 files changed, 13 insertions, 16 deletions
diff --git a/t/app/controller/report_display.t b/t/app/controller/report_display.t
index 07e8caa9b..002cdc1e5 100644
--- a/t/app/controller/report_display.t
+++ b/t/app/controller/report_display.t
@@ -470,33 +470,33 @@ subtest "Zurich banners are displayed correctly" => sub {
};
};
-$mech->create_body_ok(2504, 'Westminster City Council');
-$mech->create_body_ok(2505, 'Camden Borough Council');
+my $body_westminster = $mech->create_body_ok(2504, 'Westminster City Council');
+my $body_camden = $mech->create_body_ok(2505, 'Camden Borough Council');
for my $test (
{
desc => 'no state dropdown if user not from authority',
from_body => undef,
no_state => 1,
- report_body => '2504',
+ report_body => $body_westminster->id,
},
{
desc => 'state dropdown if user from authority',
- from_body => 2504,
+ from_body => $body_westminster->id,
no_state => 0,
- report_body => '2504',
+ report_body => $body_westminster->id,
},
{
desc => 'no state dropdown if user not from same body as problem',
- from_body => 2505,
+ from_body => $body_camden->id,
no_state => 1,
- report_body => '2504',
+ report_body => $body_westminster->id,
},
{
desc => 'state dropdown if user from authority and problem sent to multiple bodies',
- from_body => 2504,
+ from_body => $body_westminster->id,
no_state => 0,
- report_body => '2504,2506',
+ report_body => $body_westminster->id . ',2506',
},
) {
subtest $test->{desc} => sub {
@@ -518,10 +518,7 @@ for my $test (
};
}
-$report->discard_changes;
-$report->bodies_str( 2504 );
-$report->update;
-
-# tidy up
-$mech->delete_user('test@example.com');
-done_testing();
+END {
+ $mech->delete_user('test@example.com');
+ done_testing();
+}