Released Static::Simple 0.08 - Added tests for everything except Apache support
[catagits/Catalyst-Plugin-Static-Simple.git] / t / 06include_path.t
diff --git a/t/06include_path.t b/t/06include_path.t
new file mode 100644 (file)
index 0000000..144f39a
--- /dev/null
@@ -0,0 +1,29 @@
+#!perl\r
+\r
+use strict;\r
+use warnings;\r
+\r
+use FindBin;\r
+use lib "$FindBin::Bin/lib";\r
+\r
+use Test::More tests => 6;\r
+use Catalyst::Test 'TestApp';\r
+\r
+# test altenate root dirs\r
+TestApp->config->{static}->{include_path} = [\r
+    TestApp->config->{root} . '/overlay',\r
+    \&TestApp::incpath_generator,\r
+    TestApp->config->{root},\r
+];\r
+\r
+# test overlay dir\r
+ok( my $res = request('http://localhost/overlay.jpg'), 'request ok' );\r
+is( $res->content_type, 'image/jpeg', 'overlay path ok' );\r
+\r
+# test incpath_generator\r
+ok( $res = request('http://localhost/incpath.css'), 'request ok' );\r
+is( $res->content_type, 'text/css', 'incpath coderef ok' );\r
+\r
+# test passthrough to root\r
+ok( $res = request('http://localhost/images/bad.gif'), 'request ok' );\r
+is( $res->content_type, 'image/gif', 'root path ok' );\r