diff options
Diffstat (limited to 't/app/controller/report_inspect.t')
-rw-r--r-- | t/app/controller/report_inspect.t | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t index 239cc408b..39dd57444 100644 --- a/t/app/controller/report_inspect.t +++ b/t/app/controller/report_inspect.t @@ -559,6 +559,7 @@ FixMyStreet::override_config { my $expected_fields = { state => 'action scheduled', category => 'Cows', + non_public => undef, public_update => '', priority => $rp->id, include_update => '1', @@ -594,6 +595,31 @@ FixMyStreet::override_config { is $report->comments->count, 1, "Only leaves one update"; like $report->comments->first->text, qr/Category changed.*Badgers/, 'update text included category change'; }; + + subtest "test non-public changing" => sub { + $report->comments->delete; + is $report->non_public, 0, 'Not set to non-public'; + $mech->get_ok("/report/$report_id"); + $mech->submit_form(button => 'save', with_fields => { include_update => 0, non_public => 1 }); + is $report->comments->count, 0, "No updates left"; + $report->discard_changes; + is $report->non_public, 1, 'Now set to non-public'; + $mech->submit_form(button => 'save', with_fields => { include_update => 0, non_public => 0 }); + is $report->comments->count, 0, "No updates left"; + $report->discard_changes; + is $report->non_public, 0, 'Not set to non-public'; + }; + + subtest "test saved-at setting" => sub { + $report->comments->delete; + $mech->get_ok("/report/$report_id"); + my $now = DateTime->now->subtract(days => 1); + $mech->submit_form(button => 'save', form_id => 'report_inspect_form', + fields => { include_update => 1, public_update => 'An update', saved_at => $now->epoch }); + $report->discard_changes; + is $report->comments->count, 1, "One update"; + is $report->comments->first->confirmed, $now; + }; }; FixMyStreet::override_config { |