Commit | Line | Data |
e37ad815 |
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 => 8;\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 | qr/^images/,\r |
16 | 'qr/^css/',\r |
17 | ];\r |
18 | \r |
19 | # a file with no extension will return text/plain\r |
20 | ok( my $res = request('http://localhost/always-static/test'), 'request ok' );\r |
21 | is( $res->content_type, 'text/plain', 'text/plain ok' );\r |
22 | \r |
23 | # a missing file in a defined static dir will return 404\r |
24 | ok( $res = request('http://localhost/always-static/404.txt'), 'request ok' );\r |
25 | is( $res->code, 404, '404 ok' );\r |
26 | \r |
27 | # qr regex test\r |
28 | ok( $res = request('http://localhost/images/catalyst.png'), 'request ok' );\r |
29 | is( $res->content_type, 'image/png', 'qr regex path ok' );\r |
30 | \r |
31 | # eval regex test\r |
32 | ok( $res = request('http://localhost/css/static.css'), 'request ok' );\r |
33 | like( $res->content, qr/background/, 'eval regex path ok' );\r |