Change configuration key to 'Plugin::Static::Simple' by default.
[catagits/Catalyst-Plugin-Static-Simple.git] / t / 05dirs.t
index acb299e..f342556 100644 (file)
@@ -1,42 +1,42 @@
-#!perl\r
-\r
-use strict;\r
-use warnings;\r
-\r
-use FindBin;\r
-use lib "$FindBin::Bin/lib";\r
-\r
-use Test::More tests => 13;\r
-use Catalyst::Test 'TestApp';\r
-\r
-# test defined static dirs\r
-TestApp->config->{static}->{dirs} = [\r
-    'always-static',\r
-    qr/^images/,\r
-    'qr/^css/',\r
-];\r
-\r
-# a file with no extension will return text/plain\r
-ok( my $res = request('http://localhost/always-static/test'), 'request ok' );\r
-is( $res->content_type, 'text/plain', 'text/plain ok' );\r
-\r
-# a file with an extension in ignore_extensions still gets served\r
-ok( $res = request('http://localhost/always-static/test.html'), 'request ok' );\r
-is( $res->code, 200, 'html file in dirs get served' );\r
-\r
-# a missing file in a defined static dir will return 404 and text/html\r
-ok( $res = request('http://localhost/always-static/404.txt'), 'request ok' );\r
-is( $res->code, 404, '404 ok' );\r
-is( $res->content_type, 'text/html', '404 is text/html' );\r
-\r
-# qr regex test\r
-ok( $res = request('http://localhost/images/catalyst.png'), 'request ok' );\r
-is( $res->content_type, 'image/png', 'qr regex path ok' );\r
-\r
-# eval regex test\r
-ok( $res = request('http://localhost/css/static.css'), 'request ok' );\r
-like( $res->content, qr/background/, 'eval regex path ok' );\r
-\r
-# A static dir with no trailing slash is handled by Cat\r
-ok( $res = request('http://localhost/always-static'), 'request ok' );\r
-is( $res->content, 'default', 'content ok' );
\ No newline at end of file
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 13;
+use Catalyst::Test 'TestApp';
+
+# test defined static dirs
+TestApp->config->{'Plugin::Static::Simple'}->{dirs} = [
+    'always-static',
+    qr/^images/,
+    'qr/^css/',
+];
+
+# a file with no extension will return text/plain
+ok( my $res = request('http://localhost/always-static/test'), 'request ok' );
+is( $res->content_type, 'text/plain', 'text/plain ok' );
+
+# a file with an extension in ignore_extensions still gets served
+ok( $res = request('http://localhost/always-static/test.html'), 'request ok' );
+is( $res->code, 200, 'html file in dirs get served' );
+
+# a missing file in a defined static dir will return 404 and text/html
+ok( $res = request('http://localhost/always-static/404.txt'), 'request ok' );
+is( $res->code, 404, '404 ok' );
+is( $res->content_type, 'text/html', '404 is text/html' );
+
+# qr regex test
+ok( $res = request('http://localhost/images/catalyst.png'), 'request ok' );
+is( $res->content_type, 'image/png', 'qr regex path ok' );
+
+# eval regex test
+ok( $res = request('http://localhost/css/static.css'), 'request ok' );
+like( $res->content, qr/background/, 'eval regex path ok' );
+
+# A static dir with no trailing slash is handled by Cat
+ok( $res = request('http://localhost/always-static'), 'request ok' );
+is( $res->content, 'default', 'content ok' );