Commit | Line | Data |
ee1e7faf |
1 | #!perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use FindBin; |
7 | use lib "$FindBin::Bin/lib"; |
8 | |
9 | use Test::More tests => 5; |
10 | use Catalyst::Test 'TestApp'; |
11 | |
12 | # test defined static dirs |
13 | TestApp->config->{'Plugin::Static::Simple'}->{dirs} = [ |
14 | 'always-static', |
15 | ]; |
16 | |
17 | TestApp->config->{'Plugin::Static::Simple'}->{debug} = 1; |
18 | |
9c5fb712 |
19 | local our $MESSAGES; |
ee1e7faf |
20 | { |
9c5fb712 |
21 | close(STDERR); |
22 | open(STDERR, ">>", \$MESSAGES); |
ee1e7faf |
23 | } |
24 | |
25 | |
26 | # a missing file in a defined static dir will return 404 and text/html |
27 | ok( my $res = request('http://localhost/always-static/404.txt'), 'request ok' ); |
28 | is( $res->code, 404, '404 ok' ); |
29 | is( $res->content_type, 'text/html', '404 is text/html' ); |
9c5fb712 |
30 | ok(defined $MESSAGES, 'debug message set'); |
31 | like( $MESSAGES, qr/404/, 'debug message contains 404'); |
ee1e7faf |
32 | |