[Catalyst-commits] r12518 - in Catalyst-Plugin-Static-Simple/trunk: . lib/Catalyst/Plugin/Static t

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Mon Jan 4 13:13:18 GMT 2010


Author: t0m
Date: 2010-01-04 13:13:18 +0000 (Mon, 04 Jan 2010)
New Revision: 12518

Added:
   Catalyst-Plugin-Static-Simple/trunk/t/20debug.t
Modified:
   Catalyst-Plugin-Static-Simple/trunk/Changes
   Catalyst-Plugin-Static-Simple/trunk/Makefile.PL
   Catalyst-Plugin-Static-Simple/trunk/lib/Catalyst/Plugin/Static/Simple.pm
Log:
Bug fix for debug mode from RT#53338

Modified: Catalyst-Plugin-Static-Simple/trunk/Changes
===================================================================
--- Catalyst-Plugin-Static-Simple/trunk/Changes	2010-01-04 02:28:35 UTC (rev 12517)
+++ Catalyst-Plugin-Static-Simple/trunk/Changes	2010-01-04 13:13:18 UTC (rev 12518)
@@ -1,5 +1,7 @@
 Revision history for Perl extension Catalyst::Plugin::Static::Simple
 
+        - Fix issues in debug mode. (RT#53338)
+
 0.27   2010-01-03 14:49:00
         - Switch to being a Moose role, removing dependencies on
           Class::Data::Inheritable and Class::Accessor (Andrey Kostenko in

Modified: Catalyst-Plugin-Static-Simple/trunk/Makefile.PL
===================================================================
--- Catalyst-Plugin-Static-Simple/trunk/Makefile.PL	2010-01-04 02:28:35 UTC (rev 12517)
+++ Catalyst-Plugin-Static-Simple/trunk/Makefile.PL	2010-01-04 13:13:18 UTC (rev 12518)
@@ -11,6 +11,7 @@
 requires 'MIME::Types' => '1.25';
 requires 'Test::More';
 requires 'Moose';
+requires 'MooseX::Types';
 requires 'namespace::autoclean';
 
 test_requires 'Test::More';

Modified: Catalyst-Plugin-Static-Simple/trunk/lib/Catalyst/Plugin/Static/Simple.pm
===================================================================
--- Catalyst-Plugin-Static-Simple/trunk/lib/Catalyst/Plugin/Static/Simple.pm	2010-01-04 02:28:35 UTC (rev 12517)
+++ Catalyst-Plugin-Static-Simple/trunk/lib/Catalyst/Plugin/Static/Simple.pm	2010-01-04 13:13:18 UTC (rev 12518)
@@ -5,12 +5,13 @@
 use File::Spec ();
 use IO::File ();
 use MIME::Types ();
+use MooseX::Types::Moose qw/ArrayRef Str/;
 use namespace::autoclean;
 
 our $VERSION = '0.27';
 
 has _static_file => ( is => 'rw' );
-has _static_debug_message => ( is => 'rw', isa => 'Str' );
+has _static_debug_message => ( is => 'rw', isa => ArrayRef[Str] );
 
 before prepare_action => sub {
     my $c = shift;

Added: Catalyst-Plugin-Static-Simple/trunk/t/20debug.t
===================================================================
--- Catalyst-Plugin-Static-Simple/trunk/t/20debug.t	                        (rev 0)
+++ Catalyst-Plugin-Static-Simple/trunk/t/20debug.t	2010-01-04 13:13:18 UTC (rev 12518)
@@ -0,0 +1,38 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 5;
+use Catalyst::Test 'TestApp';
+
+# test defined static dirs
+TestApp->config->{static}->{dirs} = [
+    'always-static',
+];
+
+TestApp->config->{static}->{debug} = 1;
+
+use Catalyst::Log;
+
+local *Catalyst::Log::_send_to_log;
+local our @MESSAGES;
+{
+    no warnings 'redefine';
+    *Catalyst::Log::_send_to_log = sub {
+        my $self = shift;
+        push @MESSAGES, @_;
+    };
+}
+
+
+# a missing file in a defined static dir will return 404 and text/html
+ok( my $res = request('http://localhost/always-static/404.txt'), 'request ok' );
+is( $res->code, 404, '404 ok' );
+is( $res->content_type, 'text/html', '404 is text/html' );
+ok(defined $MESSAGES[0], 'debug message set');
+like( $MESSAGES[0], qr/404/, 'debug message contains 404'); 
+




More information about the Catalyst-commits mailing list