diff options
Diffstat (limited to 't/app/controller')
-rw-r--r-- | t/app/controller/report_updates.t | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t index cf6af16cb..82670d6cc 100644 --- a/t/app/controller/report_updates.t +++ b/t/app/controller/report_updates.t @@ -577,7 +577,12 @@ for my $test ( is $update->problem_state, $test->{state}, 'problem state set'; my $update_meta = $mech->extract_update_metas; - like $update_meta->[0], qr/marked as $test->{fields}->{state}$/, 'update meta includes state change'; + # setting it to confirmed shouldn't say anything + if ( $test->{fields}->{state} ne 'confirmed' ) { + like $update_meta->[0], qr/marked as $test->{fields}->{state}$/, 'update meta includes state change'; + } else { + like $update_meta->[0], qr/reopened$/, 'update meta includes state change'; + } like $update_meta->[0], qr{Test User \(Westminster City Council\)}, 'update meta includes council name'; $mech->content_contains( 'Test User (<strong>Westminster City Council</strong>)', 'council name in bold'); @@ -586,6 +591,44 @@ for my $test ( }; } +subtest 'check meta correct for comments marked confirmed but not marked open' => sub { + $report->comments->delete; + my $comment = FixMyStreet::App->model('DB::Comment')->create( + { + user => $user, + problem_id => $report->id, + text => 'update text', + confirmed => DateTime->now, + problem_state => 'confirmed', + anonymous => 0, + mark_open => 0, + mark_fixed => 0, + state => 'confirmed', + } + ); + + $mech->get_ok( "/report/" . $report->id ); + my $update_meta = $mech->extract_update_metas; + like $update_meta->[0], qr/reopened$/, + 'update meta does not say reopened'; + + $comment->update( { mark_open => 1, problem_state => undef } ); + $mech->get_ok( "/report/" . $report->id ); + $update_meta = $mech->extract_update_metas; + + unlike $update_meta->[0], qr/marked as open$/, + 'update meta does not says marked as open'; + like $update_meta->[0], qr/reopened$/, 'update meta does say reopened'; + + $comment->update( { mark_open => 0, problem_state => undef } ); + $mech->get_ok( "/report/" . $report->id ); + $update_meta = $mech->extract_update_metas; + + unlike $update_meta->[0], qr/marked as open$/, + 'update meta does not says marked as open'; + unlike $update_meta->[0], qr/reopened$/, 'update meta does not say reopened'; + }; + $user->from_council(0); $user->update; |