From: Zbigniew Łukasiak Date: Tue, 17 Nov 2009 13:40:49 +0000 (+0000) Subject: CatalystX::LeakChecker needs to be injected into the Context class now X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=fdcc808c0c3e0c1b24940b21f62f892d4700e998 CatalystX::LeakChecker needs to be injected into the Context class now --- diff --git a/t/lib/TestApp.pm b/t/lib/TestApp.pm index a2fc0b2..94bddd9 100644 --- a/t/lib/TestApp.pm +++ b/t/lib/TestApp.pm @@ -12,6 +12,7 @@ use Catalyst qw/ +TestApp::Role /; use Catalyst::Utils; +use TestApp::Context; use Moose; use namespace::autoclean; @@ -20,25 +21,7 @@ our $VERSION = '0.01'; TestApp->config( name => 'TestApp', root => '/some/dir' ); -if (eval { Class::MOP::load_class('CatalystX::LeakChecker'); 1 }) { - with 'CatalystX::LeakChecker'; - - has leaks => ( - is => 'ro', - default => sub { [] }, - ); -} - -sub found_leaks { - my ($ctx, @leaks) = @_; - push @{ $ctx->leaks }, @leaks; -} - -sub count_leaks { - my ($ctx) = @_; - return scalar @{ $ctx->leaks }; -} - +TestApp->context_class( 'TestApp::Context' ); TestApp->setup; sub execute { diff --git a/t/lib/TestApp/Context.pm b/t/lib/TestApp/Context.pm new file mode 100644 index 0000000..3b09d79 --- /dev/null +++ b/t/lib/TestApp/Context.pm @@ -0,0 +1,25 @@ +package TestApp::Context; +use Moose; +extends 'Catalyst::Context'; + +if (eval { Class::MOP::load_class('CatalystX::LeakChecker'); 1 }) { + with 'CatalystX::LeakChecker'; + + has leaks => ( + is => 'ro', + default => sub { [] }, + ); +} + +sub found_leaks { + my ($ctx, @leaks) = @_; + push @{ $ctx->leaks }, @leaks; +} + +sub count_leaks { + my ($ctx) = @_; + return scalar @{ $ctx->leaks }; +} + +1; +