Change configuration key to 'Plugin::Static::Simple' by default.
[catagits/Catalyst-Plugin-Static-Simple.git] / t / 06include_path.t
1 #!perl
2
3 use strict;
4 use warnings;
5
6 use FindBin;
7 use lib "$FindBin::Bin/lib";
8
9 use Test::More tests => 6;
10 use Catalyst::Test 'TestApp';
11
12 # test altenate root dirs
13 TestApp->config->{'Plugin::Static::Simple'}->{include_path} = [
14     TestApp->config->{root} . '/overlay',
15     \&TestApp::incpath_generator,
16     TestApp->config->{root},
17 ];
18
19 # test overlay dir
20 ok( my $res = request('http://localhost/overlay.jpg'), 'request ok' );
21 is( $res->content_type, 'image/jpeg', 'overlay path ok' );
22
23 # test incpath_generator
24 ok( $res = request('http://localhost/incpath.css'), 'request ok' );
25 is( $res->content_type, 'text/css', 'incpath coderef ok' );
26
27 # test passthrough to root
28 ok( $res = request('http://localhost/images/bad.gif'), 'request ok' );
29 is( $res->content_type, 'image/gif', 'root path ok' );