Skip to content

Instantly share code, notes, and snippets.

@mash
Created July 22, 2009 05:47
Show Gist options
  • Save mash/151837 to your computer and use it in GitHub Desktop.
Save mash/151837 to your computer and use it in GitHub Desktop.
use Test::Base;
{
package TestApp;
use Ark;
package TestApp::Controller::Root;
use Ark 'Controller';
has '+namespace' => default => '';
sub auto :Private {
my ($self, $c) = @_;
die;
return 1;
}
sub index :Path :Args(0) {
my ($self, $c) = @_;
$c->res->body('hi');
}
}
plan 'no_plan';
use Ark::Test 'TestApp',
components => [
qw/
Controller::Root
/
];
{
my $res = request( GET => '/');
ok($res, 'response ok');
isa_ok($res, 'HTTP::Response');
is($res->code, 500, 'internal server error ok');
}
__END__
santrini% prove -vlr t/die_in_auto.t ~/Shiraberu/ark-perl
t/die_in_auto.t .. [error] Caught exception in engine "Died at t/die_in_auto.t line 15."
ok 1 - response ok
ok 2 - The object isa HTTP::Response
not ok 3 - internal server error ok
# Failed test 'internal server error ok'
# at t/die_in_auto.t line 39.
# got: '200'
# expected: '500'
1..3
# Looks like you failed 1 test of 3.
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/3 subtests
Test Summary Report
-------------------
t/die_in_auto.t (Wstat: 256 Tests: 3 Failed: 1)
Failed test: 3
Non-zero exit status: 1
Files=1, Tests=3, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.26 cusr 0.02 csys = 0.32 CPU)
Result: Failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment