Commit | Line | Data |
151b8e0f |
1 | #!perl\r |
2 | \r |
3 | use strict;\r |
4 | use warnings;\r |
5 | \r |
6 | use FindBin;\r |
7 | use lib "$FindBin::Bin/lib";\r |
8 | \r |
9 | use Test::More tests => 5;\r |
10 | use Catalyst::Test 'TestApp';\r |
11 | \r |
12 | # test defined static dirs\r |
13 | TestApp->config->{static}->{dirs} = [\r |
14 | 'always-static',\r |
15 | ];\r |
16 | \r |
17 | TestApp->config->{static}->{debug} = 1;\r |
18 | \r |
19 | use Catalyst::Log;\r |
20 | \r |
21 | local *Catalyst::Log::_send_to_log;\r |
22 | local our @MESSAGES;\r |
23 | {\r |
24 | no warnings 'redefine';\r |
25 | *Catalyst::Log::_send_to_log = sub {\r |
26 | my $self = shift;\r |
27 | push @MESSAGES, @_;\r |
28 | };\r |
29 | }\r |
30 | \r |
31 | \r |
32 | # a missing file in a defined static dir will return 404 and text/html\r |
33 | ok( my $res = request('http://localhost/always-static/404.txt'), 'request ok' );\r |
34 | is( $res->code, 404, '404 ok' );\r |
35 | is( $res->content_type, 'text/html', '404 is text/html' );\r |
36 | ok(defined $MESSAGES[0], 'debug message set');\r |
37 | like( $MESSAGES[0], qr/404/, 'debug message contains 404'); \r |
38 | \r |