aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2018-06-18 16:57:33 +0100
committerStruan Donald <struan@exo.org.uk>2018-06-20 16:33:05 +0100
commite1853898c154356bf0af7ef021f9b1c519e8340b (patch)
tree266797119124da3fadd3dd46289d053a3ee1d557 /t
parent9d71b5f3012e244200fa59d118394fdb8982c752 (diff)
send unresponsive details back with category extras
This allows the mobile app to explicitly detect when a body is unresponsive and display the category_extra text. For mysociety/fixmystreet-mobile#266
Diffstat (limited to 't')
-rw-r--r--t/app/controller/report_new.t6
1 files changed, 6 insertions, 0 deletions
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t
index 4022ba31a..4f229dc8c 100644
--- a/t/app/controller/report_new.t
+++ b/t/app/controller/report_new.t
@@ -1640,6 +1640,10 @@ subtest "unresponsive body handling works" => sub {
$mech->get_ok('/report/new/ajax?latitude=55.952055&longitude=-3.189579'); # Edinburgh
my $body_id = $contact1->body->id;
ok $mech->content_like( qr{Edinburgh.*accept reports.*/unresponsive\?body=$body_id} );
+ my $extra_details = $mech->get_ok_json('/report/new/ajax?latitude=55.952055&longitude=-3.189579');
+ is $extra_details->{unresponsive}, $body_id, "unresponsive json set";
+ $extra_details = $mech->get_ok_json('/report/new/category_extras?category=Street%20lighting&latitude=55.952055&longitude=-3.189579');
+ is $extra_details->{unresponsive}, $body_id, "unresponsive json set";
my $test_email = 'test-2@example.com';
$mech->log_out_ok;
@@ -1715,6 +1719,8 @@ subtest "unresponsive body handling works" => sub {
$contact3->update( { email => 'REFUSED' } );
$mech->get_ok('/report/new/category_extras?category=Trees&latitude=51.896268&longitude=-2.093063');
ok $mech->content_like( qr/Cheltenham.*Trees.*unresponsive.*category=Trees/ );
+ $extra_details = $mech->get_ok_json('/report/new/category_extras?category=Trees&latitude=51.896268&longitude=-2.093063');
+ is $extra_details->{unresponsive}, $contact3->body->id, "unresponsive json set";
$mech->get_ok('/around');
$mech->submit_form_ok( { with_fields => { pc => 'GL50 2PR', } }, "submit location" );