aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorChris Mytton <self@hecticjeff.net>2013-11-07 17:49:36 +0000
committerMatthew Somerville <matthew@mysociety.org>2013-11-11 16:12:32 +0000
commit38e83cdcd305afdcb080f66226ddeb1660fa8f05 (patch)
treec2b169c5c0ad510f0d13e27f1bf962086bd8a4fd /t
parentab1625b7eaec127c727c236b98ba47a6643f4625 (diff)
Don't display categories for deleted bodies
When a body has been marked as deleted (currently only exposed in the Zurich cobrand's admin) the categories for that body should not be available on the report_new form. Prior to this change there was an error running the 'zurich-overdue-alert' script, because it wasn't expecting the 'bodies_str' field to have any entries in the format 'x|y,z', this prevents this problem from happening in the future (though it doesn't fix any existing entries with this issue).
Diffstat (limited to 't')
-rw-r--r--t/app/controller/report_new.t18
1 files changed, 18 insertions, 0 deletions
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t
index 4a6ba9bac..2993eddac 100644
--- a/t/app/controller/report_new.t
+++ b/t/app/controller/report_new.t
@@ -1459,6 +1459,24 @@ subtest "test SeeSomething" => sub {
$bus_contact->delete;
};
+subtest "categories from deleted bodies shouldn't be visible for new reports" => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { fixmystreet => '.' } ],
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->get_ok('/report/new/ajax?latitude=51.89&longitude=-2.09'); # Cheltenham
+ ok $mech->content_contains( $contact3->category );
+
+ # Delete the body which the contact belongs to.
+ $contact3->body->update( { deleted => 1 } );
+
+ $mech->get_ok('/report/new/ajax?latitude=51.89&longitude=-2.09'); # Cheltenham
+ ok $mech->content_lacks( $contact3->category );
+
+ $contact3->body->update( { deleted => 0 } );
+ };
+};
+
$contact1->delete;
$contact2->delete;
$contact3->delete;