From: Tomas Doran Date: Tue, 6 Oct 2009 16:32:02 +0000 (+0000) Subject: Fix warnings in new Catalyst X-Git-Tag: v0.23~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Plugin-Static-Simple.git;a=commitdiff_plain;h=919acaed08984151c70b2cbcc622ba5cfae1ffa4 Fix warnings in new Catalyst --- diff --git a/Changes b/Changes index e06c9db..bb76923 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for Perl extension Catalyst::Plugin::Static::Simple + - Move actions out of TestApp into a Root controller as + this is now deprecated. + 0.22 2009-08-21 18:14:59 - Add tests for delivering empty files. - Fix those tests by depending on Catalyst-Runtime 5.80008. diff --git a/t/11serve_static.t b/t/11serve_static.t index 470b72c..f98760f 100644 --- a/t/11serve_static.t +++ b/t/11serve_static.t @@ -14,8 +14,8 @@ ok( my $res = request('http://localhost/serve_static'), 'request ok' ); is( $res->code, 200, '200 ok' ); # .pm can be both application/x-pagemaker or text/x-perl, so only check for a slash like( $res->content_type, qr{/}, 'content-type ok' ); -like( $res->content, qr/serve_static/, 'content of serve_static ok' ); +like( $res->content, qr/package TestApp/, 'content of serve_static ok' ); # test getting a non-existant file via serve_static_file ok( $res = request('http://localhost/serve_static_404'), 'request ok' ); -is( $res->code, 404, '404 ok' ); \ No newline at end of file +is( $res->code, 404, '404 ok' ); diff --git a/t/lib/TestApp.pm b/t/lib/TestApp.pm index 001fb01..cdd73f5 100644 --- a/t/lib/TestApp.pm +++ b/t/lib/TestApp.pm @@ -2,7 +2,6 @@ package TestApp; use strict; use Catalyst; -use File::Spec::Functions; use FindBin; our $VERSION = '0.01'; @@ -29,38 +28,4 @@ sub incpath_generator { return [ $c->config->{root} . '/incpath' ]; } -sub default : Private { - my ( $self, $c ) = @_; - - $c->res->output( 'default' ); -} - -sub subtest : Local { - my ( $self, $c ) = @_; - - $c->res->output( $c->subreq('/subtest2') ); -} - -sub subtest2 : Local { - my ( $self, $c ) = @_; - - $c->res->output( 'subtest2 ok' ); -} - -sub serve_static : Local { - my ( $self, $c ) = @_; - - my $file = catfile( $FindBin::Bin, 'lib', 'TestApp.pm' ); - - $c->serve_static_file( $file ); -} - -sub serve_static_404 : Local { - my ( $self, $c ) = @_; - - my $file = catfile( $FindBin::Bin, 'lib', 'foo.pm' ); - - $c->serve_static_file( $file ); -} - 1; diff --git a/t/lib/TestApp/Controller/Root.pm b/t/lib/TestApp/Controller/Root.pm new file mode 100644 index 0000000..d3dc5ee --- /dev/null +++ b/t/lib/TestApp/Controller/Root.pm @@ -0,0 +1,45 @@ +package TestApp::Controller::Root; + +use strict; +use warnings; +use File::Spec::Functions; + +use base qw/Catalyst::Controller/; + +__PACKAGE__->config(namespace => ''); + +sub default : Private { + my ( $self, $c ) = @_; + + $c->res->output( 'default' ); +} + +sub subtest : Local { + my ( $self, $c ) = @_; + + $c->res->output( $c->subreq('/subtest2') ); +} + +sub subtest2 : Local { + my ( $self, $c ) = @_; + + $c->res->output( 'subtest2 ok' ); +} + +sub serve_static : Local { + my ( $self, $c ) = @_; + + my $file = catfile( $FindBin::Bin, 'lib', 'TestApp.pm' ); + + $c->serve_static_file( $file ); +} + +sub serve_static_404 : Local { + my ( $self, $c ) = @_; + + my $file = catfile( $FindBin::Bin, 'lib', 'foo.pm' ); + + $c->serve_static_file( $file ); +} + +1;