7 use lib "$FindBin::Bin/lib";
9 use Test::More tests => 13;
10 use Catalyst::Test 'TestApp';
12 # test defined static dirs
13 TestApp->config->{'Plugin::Static::Simple'}->{dirs} = [
19 # a file with no extension will return text/plain
20 ok( my $res = request('http://localhost/always-static/test'), 'request ok' );
21 is( $res->content_type, 'text/plain', 'text/plain ok' );
23 # a file with an extension in ignore_extensions still gets served
24 ok( $res = request('http://localhost/always-static/test.html'), 'request ok' );
25 is( $res->code, 200, 'html file in dirs get served' );
27 # a missing file in a defined static dir will return 404 and text/html
28 ok( $res = request('http://localhost/always-static/404.txt'), 'request ok' );
29 is( $res->code, 404, '404 ok' );
30 is( $res->content_type, 'text/html', '404 is text/html' );
33 ok( $res = request('http://localhost/images/catalyst.png'), 'request ok' );
34 is( $res->content_type, 'image/png', 'qr regex path ok' );
37 ok( $res = request('http://localhost/css/static.css'), 'request ok' );
38 like( $res->content, qr/background/, 'eval regex path ok' );
40 # A static dir with no trailing slash is handled by Cat
41 ok( $res = request('http://localhost/always-static'), 'request ok' );
42 is( $res->content, 'default', 'content ok' );