diff options
Diffstat (limited to 't')
-rw-r--r-- | t/app/controller/report_inspect.t | 24 | ||||
-rw-r--r-- | t/app/controller/report_updates.t | 17 |
2 files changed, 32 insertions, 9 deletions
diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t index 00b4e3b38..e1723b0cd 100644 --- a/t/app/controller/report_inspect.t +++ b/t/app/controller/report_inspect.t @@ -221,12 +221,32 @@ FixMyStreet::override_config { 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 => 'Action Scheduled', include_update => undef } }); + $mech->submit_form_ok({ button => 'save', with_fields => { traffic_information => 'Signs and Cones', state => 'Investigating', include_update => undef } }); $report->discard_changes; - is $report->state, 'action scheduled', 'report state changed'; + is $report->state, 'investigating', '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 { diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t index de153978b..a1e26476f 100644 --- a/t/app/controller/report_updates.t +++ b/t/app/controller/report_updates.t @@ -134,7 +134,7 @@ for my $test ( subtest "updates displayed on report with empty bodies_str" => sub { my $old_bodies_str = $report->bodies_str; $report->update({ bodies_str => undef }); - $comment->update({ problem_state => 'fixed' , mark_open => 'false', mark_fixed => 'false' }); + $comment->update({ problem_state => 'fixed - user' , mark_open => 'false', mark_fixed => 'false' }); $mech->get_ok("/report/$report_id"); @@ -587,9 +587,10 @@ for my $test ( name => $user->name, may_show_name => 1, update => 'Set state to fixed', - state => 'fixed', + state => 'fixed - council', }, state => 'fixed - council', + meta => 'fixed', }, { desc => 'from authority user marks report as action scheduled', @@ -661,9 +662,10 @@ for my $test ( name => $user->name, may_show_name => 1, update => 'Set state to fixed', - state => 'fixed', + state => 'fixed - council', }, state => 'fixed - council', + meta => 'fixed', report_bodies => $body->id . ',2505', }, { @@ -672,9 +674,10 @@ for my $test ( name => $user->name, may_show_name => 1, update => 'Set state to fixed', - state => 'fixed', + state => 'fixed - council', }, state => 'fixed - council', + meta => 'fixed', report_bodies => $body->id . ',2505', view_username => 1 }, @@ -1662,14 +1665,14 @@ for my $test ( }, { desc => 'update fixed without marking as open leaves state unchanged', - initial_state => 'fixed', + initial_state => 'fixed - user', expected_form_fields => { reopen => undef, }, submitted_form_fields => { reopen => 0, }, - end_state => 'fixed', + end_state => 'fixed - user', }, { desc => 'update unable to fix without marking as fixed leaves state unchanged', @@ -1761,7 +1764,7 @@ for my $test ( }, { desc => 'cannot mark fixed as fixed, can mark as not fixed', - initial_state => 'fixed', + initial_state => 'fixed - user', expected_form_fields => { reopen => undef, }, |