X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F04static.t;h=bae292281920403a72a3d68b851540cf65e0ef26;hb=a5d909f1c01cb34610ada7807e448fda6652b2db;hp=edb897487f0acd5f316e3e3425fd0b9b9a735bae;hpb=e37ad815c40f3cbde50ad12cd6b3ac68f0dc7399;p=catagits%2FCatalyst-Plugin-Static-Simple.git diff --git a/t/04static.t b/t/04static.t index edb8974..bae2922 100644 --- a/t/04static.t +++ b/t/04static.t @@ -6,7 +6,11 @@ use warnings; use FindBin; use lib "$FindBin::Bin/lib"; -use Test::More tests => 7; +# Module::Build craps out on files with spaces so it's not included in the dist +my $has_space_file = -e "$FindBin::Bin/lib/TestApp/root/files/space file.txt"; + +use Test::More; +plan tests => ($has_space_file) ? 12 : 9; use Catalyst::Test 'TestApp'; # test getting a css file @@ -14,6 +18,13 @@ ok( my $res = request('http://localhost/files/static.css'), 'request ok' ); is( $res->content_type, 'text/css', 'content-type text/css ok' ); like( $res->content, qr/background/, 'content of css ok' ); +# test a file with spaces +if ( $has_space_file ) { + ok( $res = request('http://localhost/files/space file.txt'), 'request ok' ); + is( $res->content_type, 'text/plain', 'content-type text/plain ok' ); + like( $res->content, qr/background/, 'content of space file ok' ); +} + # test a non-existent file ok( $res = request('http://localhost/files/404.txt'), 'request ok' ); is( $res->content, 'default', 'default handler for non-existent content ok' ); @@ -21,3 +32,6 @@ is( $res->content, 'default', 'default handler for non-existent content ok' ); # test unknown extension ok( $res = request('http://localhost/files/err.omg'), 'request ok' ); is( $res->content_type, 'text/plain', 'unknown extension as text/plain ok' ); + +ok( $res = request('http://localhost/files/empty.txt'), 'request ok' ); +is( $res->content, '', 'empty files result in an empty response' );