Debian Codegraph @

t/issues/gh-936.t

raw
1 use warnings;
2 use strict;
3
4 use Test::More;
5 use Plack::Test;
6 use HTTP::Request::Common;
7
8 {
9 package TestApp;
10 use Dancer2;
11
12 set views => 't/issues/gh-936/views';
13 set error_template => 'error';
14
15 get '/does-not-exist' => sub {
16 send_error "not found", 404;
17 };
18 }
19
20 my $test = Plack::Test->create( Dancer2->psgi_app );
21
22 for my $path ( qw{does-not-exist anywhere} ) {
23 subtest "$path" => sub {
24 my $res = $test->request( GET "/$path" );
25
26 is $res->code, 404, 'status is 404';
27 like $res->content, qr{CUSTOM ERROR TEMPLATE GOES HERE},
28 'Error message looks good';
29 };
30 }
31
32 done_testing();
33