Complete rewrite to use Plack Middleware.
[catagits/Catalyst-Plugin-Static-Simple.git] / t / 20debug.t
CommitLineData
ee1e7faf 1#!perl
2
3use strict;
4use warnings;
5
6use FindBin;
7use lib "$FindBin::Bin/lib";
8
9use Test::More tests => 5;
10use Catalyst::Test 'TestApp';
11
12# test defined static dirs
13TestApp->config->{'Plugin::Static::Simple'}->{dirs} = [
14 'always-static',
15];
16
17TestApp->config->{'Plugin::Static::Simple'}->{debug} = 1;
18
9c5fb712 19local our $MESSAGES;
ee1e7faf 20{
9c5fb712 21 close(STDERR);
22 open(STDERR, ">>", \$MESSAGES);
ee1e7faf 23}
24
25
26# a missing file in a defined static dir will return 404 and text/html
27ok( my $res = request('http://localhost/always-static/404.txt'), 'request ok' );
28is( $res->code, 404, '404 ok' );
29is( $res->content_type, 'text/html', '404 is text/html' );
9c5fb712 30ok(defined $MESSAGES, 'debug message set');
31like( $MESSAGES, qr/404/, 'debug message contains 404');
ee1e7faf 32