Change configuration key to 'Plugin::Static::Simple' by default.
[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
19use Catalyst::Log;
20
21local *Catalyst::Log::_send_to_log;
22local our @MESSAGES;
23{
24 no warnings 'redefine';
25 *Catalyst::Log::_send_to_log = sub {
26 my $self = shift;
27 push @MESSAGES, @_;
28 };
29}
30
31
32# a missing file in a defined static dir will return 404 and text/html
33ok( my $res = request('http://localhost/always-static/404.txt'), 'request ok' );
34is( $res->code, 404, '404 ok' );
35is( $res->content_type, 'text/html', '404 is text/html' );
36ok(defined $MESSAGES[0], 'debug message set');
37like( $MESSAGES[0], qr/404/, 'debug message contains 404');
38