diff options
Diffstat (limited to 't/app/controller/report_updates.t')
-rw-r--r-- | t/app/controller/report_updates.t | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t index 81174181c..4cb035bac 100644 --- a/t/app/controller/report_updates.t +++ b/t/app/controller/report_updates.t @@ -928,6 +928,48 @@ subtest 'check meta correct for second comment marking as reopened' => sub { like $update_meta->[1], qr/reopened/, 'update meta says reopened'; }; +subtest "check first comment with status change but no text is displayed" => sub { + $user->from_body( $body->id ); + $user->update; + + $report->comments->delete; + + my $comment = FixMyStreet::App->model('DB::Comment')->create( + { + user => $user, + name => $user->from_body->name, + problem_id => $report->id, + text => '', + confirmed => DateTime->now( time_zone => 'local'), + problem_state => 'investigating', + anonymous => 0, + mark_open => 0, + mark_fixed => 0, + state => 'confirmed', + } + ); + $mech->log_in_ok( $user->email ); + + $mech->get_ok("/report/$report_id"); + + my $update_meta = $mech->extract_update_metas; + like $update_meta->[0], qr/Updated by/, 'updated by meta if no text'; + unlike $update_meta->[0], qr/Test User/, 'commenter name not included'; + like $update_meta->[0], qr/investigating/, 'update meta includes state change'; + + ok $user->user_body_permissions->create({ + body => $body, + permission_type => 'view_body_contribute_details' + }), 'Give user view_body_contribute_details permissions'; + + $mech->get_ok("/report/$report_id"); + $update_meta = $mech->extract_update_metas; + like $update_meta->[0], qr/Updated by/, 'updated by meta if no text'; + like $update_meta->[0], qr/Test User/, 'commenter name included if user has view contribute permission'; + like $update_meta->[0], qr/investigating/, 'update meta includes state change'; +}; + + $user->from_body(undef); $user->update; |