aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-07-07 13:49:05 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-07-07 13:49:05 +0100
commit44819320af5533bb03a0855a75da0c9ffd207ee8 (patch)
treeb42efd3598d5ef52eab09d3f58c8e451a3f67047 /t
parent719afb490479aa1cbc306b81a7534bb8a8affbf3 (diff)
parentc93ebfa26b864c26b9219b59f6676371e434ea0a (diff)
Merge branch 'issues/forcouncils/195-overloaded-action-scheduled'
Diffstat (limited to 't')
-rw-r--r--t/app/controller/report_inspect.t52
1 files changed, 25 insertions, 27 deletions
diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t
index e3d24e9a9..481d8dc87 100644
--- a/t/app/controller/report_inspect.t
+++ b/t/app/controller/report_inspect.t
@@ -65,13 +65,15 @@ FixMyStreet::override_config {
};
subtest "test inspect & instruct submission" => sub {
- $report->unset_extra_metadata('inspected');
+ $user->user_body_permissions->create({ body => $oxon, permission_type => 'report_instruct' });
$report->state('confirmed');
$report->update;
- $report->inspection_log_entry->delete;
my $reputation = $report->user->get_extra_metadata("reputation");
$mech->get_ok("/report/$report_id");
- $mech->submit_form_ok({ button => 'save', with_fields => { public_update => "This is a public update.", include_update => "1", state => 'action scheduled' } });
+ $mech->submit_form_ok({ button => 'save', with_fields => {
+ public_update => "This is a public update.", include_update => "1",
+ state => 'action scheduled', raise_defect => 1,
+ } });
$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';
@@ -203,46 +205,42 @@ FixMyStreet::override_config {
};
subtest "test positive reputation" => sub {
+ $user->user_body_permissions->create({ body => $oxon, permission_type => 'report_instruct' });
$report->unset_extra_metadata('inspected');
$report->update;
$report->inspection_log_entry->delete if $report->inspection_log_entry;
my $reputation = $report->user->get_extra_metadata("reputation") || 0;
$mech->get_ok("/report/$report_id");
- $mech->submit_form_ok({ button => 'save', with_fields => { state => 'action scheduled', include_update => undef } });
+ $mech->submit_form_ok({ button => 'save', with_fields => {
+ state => 'in progress', include_update => undef,
+ } });
$report->discard_changes;
- is $report->get_extra_metadata('inspected'), 1, 'report marked as inspected';
+ is $report->get_extra_metadata('inspected'), undef, 'report not marked as inspected';
+
+ $mech->submit_form_ok({ button => 'save', with_fields => {
+ state => 'action scheduled', include_update => undef,
+ } });
+ $report->discard_changes;
+ is $report->get_extra_metadata('inspected'), undef, 'report not marked as inspected';
is $report->user->get_extra_metadata('reputation'), $reputation+1, "User reputation was increased";
+
+ $mech->submit_form_ok({ button => 'save', with_fields => {
+ state => 'action scheduled', include_update => undef,
+ raise_defect => 1,
+ } });
+ $report->discard_changes;
+ is $report->get_extra_metadata('inspected'), 1, 'report marked as inspected';
};
subtest "Oxfordshire-specific traffic management options are shown" => sub {
$report->update({ state => 'confirmed' });
$mech->get_ok("/report/$report_id");
- $mech->submit_form_ok({ button => 'save', with_fields => { traffic_information => 'Signs and Cones', state => 'Investigating', include_update => undef } });
+ $mech->submit_form_ok({ button => 'save', with_fields => { traffic_information => 'Signs and Cones', state => 'Action Scheduled', include_update => undef } });
$report->discard_changes;
- is $report->state, 'investigating', 'report state changed';
+ is $report->state, 'action scheduled', 'report state changed';
is $report->get_extra_metadata('traffic_information'), 'Signs and Cones', 'report data changed';
};
- subtest "Action scheduled only shown appropriately" => sub {
- $report->update({ state => 'confirmed' });
- $mech->get_ok("/report/$report_id");
- $mech->content_lacks('action scheduled');
-
- # If the report is already in that state, though, we should show it
- $report->update({ state => 'action scheduled' });
- $mech->get_ok("/report/$report_id");
- $mech->content_unlike(qr/<optgroup label="Scheduled">\s*<option value="action scheduled">Action Scheduled<\/option>/);
- $mech->content_contains('<option selected value="action scheduled">Action Scheduled</option>');
-
- $user->user_body_permissions->create({ body => $oxon, permission_type => 'report_instruct' });
- $mech->get_ok("/report/$report_id");
- $mech->content_like(qr/<optgroup label="Scheduled">\s*<option selected value="action scheduled">Action Scheduled<\/option>/);
-
- $report->update({ state => 'confirmed' });
- $mech->get_ok("/report/$report_id");
- $mech->content_like(qr/<optgroup label="Scheduled">\s*<option value="action scheduled">Action Scheduled<\/option>/);
- };
-
};
FixMyStreet::override_config {