aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/reports.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/reports.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/reports.t')
-rw-r--r--t/app/controller/reports.t22
1 files changed, 11 insertions, 11 deletions
diff --git a/t/app/controller/reports.t b/t/app/controller/reports.t
index 36af2f36a..1b4fc3526 100644
--- a/t/app/controller/reports.t
+++ b/t/app/controller/reports.t
@@ -9,17 +9,17 @@ use DateTime;
ok( my $mech = FixMyStreet::TestMech->new, 'Created mech object' );
$mech->create_body_ok(2514, 'Birmingham City Council');
-$mech->create_body_ok(2651, 'City of Edinburgh Council');
-$mech->create_body_ok(2504, 'Westminster City Council');
-$mech->create_body_ok(2649, 'Fife Council');
+my $body_edin_id = $mech->create_body_ok(2651, 'City of Edinburgh Council')->id;
+my $body_west_id = $mech->create_body_ok(2504, 'Westminster City Council')->id;
+my $body_fife_id = $mech->create_body_ok(2649, 'Fife Council')->id;
-$mech->delete_problems_for_body( 2504 );
-$mech->delete_problems_for_body( 2651 );
-$mech->delete_problems_for_body( 2649 );
+$mech->delete_problems_for_body( $body_west_id );
+$mech->delete_problems_for_body( $body_edin_id );
+$mech->delete_problems_for_body( $body_fife_id );
-my @edinburgh_problems = $mech->create_problems_for_body(3, 2651, 'All reports');
-my @westminster_problems = $mech->create_problems_for_body(5, 2504, 'All reports');
-my @fife_problems = $mech->create_problems_for_body(15, 2649, 'All reports');
+my @edinburgh_problems = $mech->create_problems_for_body(3, $body_edin_id, 'All reports');
+my @westminster_problems = $mech->create_problems_for_body(5, $body_west_id, 'All reports');
+my @fife_problems = $mech->create_problems_for_body(15, $body_fife_id, 'All reports');
is scalar @westminster_problems, 5, 'correct number of westminster problems created';
is scalar @edinburgh_problems, 3, 'correct number of edinburgh problems created';
@@ -114,7 +114,7 @@ FixMyStreet::override_config {
$mech->title_like(qr/Westminster City Council/);
$mech->content_contains('Westminster City Council');
-$mech->content_contains('All reports Test 3 for 2504', 'problem to be marked non public visible');
+$mech->content_contains('All reports Test 3 for ' . $body_west_id, 'problem to be marked non public visible');
my $problems = $mech->extract_problem_list;
is scalar @$problems, 5, 'correct number of problems displayed';
@@ -185,7 +185,7 @@ FixMyStreet::override_config {
$problems = $mech->extract_problem_list;
is scalar @$problems, 4, 'only public problems are displayed';
-$mech->content_lacks('All reports Test 3 for 2504', 'non public problem is not visible');
+$mech->content_lacks('All reports Test 3 for ' . $body_west_id, 'non public problem is not visible');
$mech->get_ok('/reports');
$stats = $mech->extract_report_stats;