Static::Simple 0.14, fix for files with spaces
[catagits/Catalyst-Plugin-Static-Simple.git] / t / 04static.t
index edb8974..ee6bcbd 100644 (file)
@@ -6,7 +6,11 @@ use warnings;
 use FindBin;\r
 use lib "$FindBin::Bin/lib";\r
 \r
-use Test::More tests => 7;\r
+# Module::Build craps out on files with spaces so it's not included in the dist\r
+my $has_space_file = -e "$FindBin::Bin/lib/TestApp/root/files/space file.txt";\r
+\r
+use Test::More;\r
+plan tests => ($has_space_file) ? 10 : 7;\r
 use Catalyst::Test 'TestApp';\r
 \r
 # test getting a css file\r
@@ -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' );\r
 like( $res->content, qr/background/, 'content of css ok' );\r
 \r
+# test a file with spaces\r
+if ( $has_space_file ) {\r
+    ok( $res = request('http://localhost/files/space file.txt'), 'request ok' );\r
+    is( $res->content_type, 'text/plain', 'content-type text/plain ok' );\r
+    like( $res->content, qr/background/, 'content of space file ok' );\r
+}\r
+\r
 # test a non-existent file\r
 ok( $res = request('http://localhost/files/404.txt'), 'request ok' );\r
 is( $res->content, 'default', 'default handler for non-existent content ok' );\r