aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/report_inspect.t
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2016-09-06 10:28:32 +0100
committerDave Arter <davea@mysociety.org>2016-09-12 14:50:51 +0100
commit839801dce77acb214cc5298f3aaa990a05b2886c (patch)
tree175c9eb9caee7dda6cccf1dd9c294db6c54450ba /t/app/controller/report_inspect.t
parent24a1d0f2b715ac10298d471f9a1683f7299a66d9 (diff)
Require inspector to provide update when instructing report
This adds an update field to the bottom of the inspect form, requiring the inspector to provide an update to be added to the report as it's sent. See mysociety/fixmystreetforcouncils#64
Diffstat (limited to 't/app/controller/report_inspect.t')
-rw-r--r--t/app/controller/report_inspect.t22
1 files changed, 22 insertions, 0 deletions
diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t
index adba77011..6d6ec6559 100644
--- a/t/app/controller/report_inspect.t
+++ b/t/app/controller/report_inspect.t
@@ -52,6 +52,28 @@ FixMyStreet::override_config {
is $report->get_extra_metadata('traffic_information'), 'Lots', 'report data changed';
};
+ subtest "test inspect & instruct submission" => sub {
+ $report->unset_extra_metadata('inspected');
+ $report->update;
+ $mech->get_ok("/report/$report_id/inspect");
+ $mech->submit_form_ok({ button => 'save_inspected', with_fields => { public_update => "This is a public update." } });
+ $report->discard_changes;
+ is $report->comments->first->text, "This is a public update.", 'Update was created';
+ is $report->get_extra_metadata('inspected'), 1, 'report marked as inspected';
+ };
+
+ subtest "test update is required when instructing" => sub {
+ $report->unset_extra_metadata('inspected');
+ $report->update;
+ $report->comments->delete_all;
+ $mech->get_ok("/report/$report_id/inspect");
+ $mech->submit_form_ok({ button => 'save_inspected', with_fields => { public_update => undef } });
+ is_deeply $mech->page_errors, [ "Please provide a public update for this report." ], 'errors match';
+ $report->discard_changes;
+ is $report->comments->count, 0, "Update wasn't created";
+ is $report->get_extra_metadata('inspected'), undef, 'report not marked as inspected';
+ };
+
subtest "test location changes" => sub {
$mech->get_ok("/report/$report_id/inspect");
$mech->submit_form_ok({ button => 'save', with_fields => { latitude => 55, longitude => -2 } });