X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F12check_error_scope.t;h=fc67c29bc09ae91f104083608d6883dc527185f5;hb=45d45d1c43d860bd411ca208c9f130ddb229c90b;hp=9a075241887a3fd7299aeb93b04ba3306406ddb2;hpb=fb25065eefb76d894a966dc1a3f93c299957219f;p=catagits%2FCatalyst-Plugin-Static-Simple.git diff --git a/t/12check_error_scope.t b/t/12check_error_scope.t index 9a07524..fc67c29 100644 --- a/t/12check_error_scope.t +++ b/t/12check_error_scope.t @@ -9,19 +9,21 @@ use FindBin; use lib "$FindBin::Bin/lib"; use Test::More tests => 3; +BEGIN { + use Catalyst::Plugin::Static::Simple; + Catalyst::Plugin::Static::Simple->meta->add_before_method_modifier( + 'prepare_action', + sub { + my ($c) = @_; + eval { die("FOO"); }; + + ok( $@, '$@ has a value.' ); + } + ); +} use Catalyst::Test 'TestApp'; -TestApp->config->{ static }->{ dirs } = [ qr{stuff/} ]; -my $orig_sub = *Catalyst::Plugin::Static::Simple::prepare_action{CODE}; - -*Catalyst::Plugin::Static::Simple::prepare_action = sub { - my ($c) = @_; - - eval { my $var = 1 / 0 }; - - ok ($@, '$@ has a value.'); - return $orig_sub->( $c ); -}; +TestApp->config->{'Plugin::Static::Simple'}->{dirs} = [qr{stuff/}]; ok( my $res = request("http://localhost/"), 'request ok' ); ok( $res->code == 200, q{Previous error doesn't crash static::simple} );