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 |
792411e6 |
9 | # Module::Build craps out on files with spaces so it's not included in the dist\r |
10 | my $has_space_file = -e "$FindBin::Bin/lib/TestApp/root/files/space file.txt";\r |
11 | \r |
12 | use Test::More;\r |
13 | plan tests => ($has_space_file) ? 10 : 7;\r |
e37ad815 |
14 | use Catalyst::Test 'TestApp';\r |
15 | \r |
16 | # test getting a css file\r |
17 | ok( my $res = request('http://localhost/files/static.css'), 'request ok' );\r |
18 | is( $res->content_type, 'text/css', 'content-type text/css ok' );\r |
19 | like( $res->content, qr/background/, 'content of css ok' );\r |
20 | \r |
792411e6 |
21 | # test a file with spaces\r |
22 | if ( $has_space_file ) {\r |
23 | ok( $res = request('http://localhost/files/space file.txt'), 'request ok' );\r |
24 | is( $res->content_type, 'text/plain', 'content-type text/plain ok' );\r |
25 | like( $res->content, qr/background/, 'content of space file ok' );\r |
26 | }\r |
27 | \r |
e37ad815 |
28 | # test a non-existent file\r |
29 | ok( $res = request('http://localhost/files/404.txt'), 'request ok' );\r |
30 | is( $res->content, 'default', 'default handler for non-existent content ok' );\r |
31 | \r |
32 | # test unknown extension\r |
33 | ok( $res = request('http://localhost/files/err.omg'), 'request ok' );\r |
34 | is( $res->content_type, 'text/plain', 'unknown extension as text/plain ok' );\r |