diff --git a/lib/PostText/Controller/Remark.pm b/lib/PostText/Controller/Remark.pm index c813802..453ad98 100644 --- a/lib/PostText/Controller/Remark.pm +++ b/lib/PostText/Controller/Remark.pm @@ -8,7 +8,7 @@ sub by_id($self) { $self->stash(remark => $remark); - $self->stash(error => 'Remark not found 🤷') + $self->stash(status => 404, error => 'Remark not found 🤷') unless keys %{$remark}; $self->render; diff --git a/t/moderator.t b/t/moderator.t index d60d753..c9d7b24 100644 --- a/t/moderator.t +++ b/t/moderator.t @@ -50,6 +50,12 @@ subtest Login => sub { $t->get_ok('/moderator/thread/hide/1') ->status_is(302) ->header_like(Location => qr{moderator/flagged}); + $t->get_ok('/moderator/thread/single/1') + ->status_is(200) + ->text_like(h2 => qr/Thread #/); + $t->get_ok('/thread/single/1') + ->status_is(404) + ->text_like(p => qr/Thread not found/); $t->get_ok('/moderator/thread/unhide/1') ->status_is(302) ->header_like(Location => qr{moderator/hidden}); @@ -57,6 +63,12 @@ subtest Login => sub { $t->get_ok('/moderator/remark/hide/1') ->status_is(302) ->header_like(Location => qr{moderator/flagged}); + $t->get_ok('/moderator/remark/single/1') + ->status_is(200) + ->text_like(h2 => qr/Remark #/); + $t->get_ok('/remark/single/1') + ->status_is(404) + ->text_like(p => qr/Remark not found/); $t->get_ok('/moderator/remark/unhide/1') ->status_is(302) ->header_like(Location => qr{moderator/hidden});