From: Tomas Doran Date: Mon, 11 May 2009 23:16:31 +0000 (+0000) Subject: Add test controller with its own meta method, still works X-Git-Tag: 5.80004~33 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=2664a81bf9d84eff55bbc3cd33916297bacdbde4 Add test controller with its own meta method, still works --- diff --git a/t/lib/TestAppWithMeta/Controller/Root.pm b/t/lib/TestAppWithMeta/Controller/Root.pm new file mode 100644 index 0000000..abda837 --- /dev/null +++ b/t/lib/TestAppWithMeta/Controller/Root.pm @@ -0,0 +1,19 @@ +package TestAppWithMeta::Controller::Root; +use Moose; +use namespace::clean -except => 'meta'; + +BEGIN { extends 'Catalyst::Controller' } + +__PACKAGE__->config( namespace => '' ); + +no warnings 'redefine'; +sub meta { 'fnar' } +use warnings 'redefine'; + +sub default : Private { + my ($self, $c) = @_; + $c->res->body($self->meta); +} + +1; + diff --git a/t/meta_method_unneeded.t b/t/meta_method_unneeded.t index f083fce..6820f3f 100644 --- a/t/meta_method_unneeded.t +++ b/t/meta_method_unneeded.t @@ -1,12 +1,13 @@ use strict; use warnings; -use Test::More tests => 1; +use FindBin qw/$Bin/; +use lib "$Bin/lib"; +use Test::More tests => 2; use Test::Exception; use Carp (); -$SIG{__DIE__} = \&Carp::confess; # Stacktrace please. # Doing various silly things, like for example -# use CGI qw/:stanard/ in your conrtoller / app +# use CGI qw/:standard/ in your conrtoller / app # will overwrite your meta method, therefore Catalyst # can't depend on it being there correctly. @@ -19,5 +20,11 @@ $SIG{__DIE__} = \&Carp::confess; # Stacktrace please. no warnings 'redefine'; sub meta {} } +BEGIN { + lives_ok { TestAppWithMeta->setup } 'Can setup an app which defines its own meta method'; +} + +use Catalyst::Test 'TestAppWithMeta'; + +ok( request('/')->is_success ); -lives_ok { TestAppWithMeta->setup } 'Can setup an app which defines its own meta method';