look a failing test case...
[catagits/Catalyst-Runtime.git] / t / lib / TestMiddlewareFromConfig / testmiddlewarefromconfig.pl
1 use Plack::Middleware::Static;
2
3 my $static = Plack::Middleware::Static->new(
4   path => qr{^/static/}, root => TestMiddlewareFromConfig->path_to('share'));
5
6 my $conf = +{
7   'Controller::Root', { namespace => '' },
8   'psgi_middleware', [
9     'Head',
10     $static,
11     'Static', { path => qr{^/static2/}, root => TestMiddlewareFromConfig->path_to('share') },
12     'Runtime',
13     '+TestMiddleware::Custom', { path => qr{^/static3/}, root => TestMiddlewareFromConfig->path_to('share') },
14     sub {
15       my $app = shift;
16       return sub {
17         my $env = shift;
18         if($env->{PATH_INFO} =~m/forced/) {
19           Plack::App::File->new(file=>TestMiddlewareFromConfig->path_to(qw/share static forced.txt/))
20             ->call($env);
21         } else {
22           return $app->($env);
23         }
24       },
25     },
26
27   ],
28 };