-#!perl
-
use strict;
use warnings;
{
my $expected = undef;
- ok( my $response = request('http://localhost/chained/foo/1/end'),
+ ok( my $response = request('http://localhost/chained/foo/1/end'),
'chained + local endpoint; missing last argument' );
is( $response->header('X-Catalyst-Executed'),
$expected, 'Executed actions' );
my $expected = join( ", ", @expected );
- ok( my $response = request('http://localhost/chained/foo2/10/20/end2/15/25'),
+ ok( my $response = request('http://localhost/chained/foo2/10/20/end2/15/25'),
'chained + local (2 args each)' );
is( $response->header('X-Catalyst-Executed'),
$expected, 'Executed actions' );
}
#
- # This is for testing if the arguments got passed to the actions
+ # This is for testing if the arguments got passed to the actions
# correctly.
#
{
}
#
+ # Test throwing an error in the middle of a chain.
#
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->chain_error_a
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/chain_error/1/end/2'),
+ "Break a chain in the middle" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'FATAL ERROR: break in the middle of a chain', 'Content OK' );
+ }
+
+ #
+ # Test dieing in the middle of a chain.
#
{
my @expected = qw[
"Break a chain in the middle" );
is( $response->header('X-Catalyst-Executed'),
$expected, 'Executed actions' );
- is( $response->content, 'FATAL ERROR: break in the middle of a chain', 'Content OK' );
+ is( $response->content, 'FATAL ERROR: Caught exception in TestApp::Controller::Action::Chained->chain_die_a "die in the middle of a chain"', 'Content OK' );
}
#
# With args given, run "all"
ok( $response = request('http://localhost/argsorder/X'),
'Correct arg order ran' );
- is( $response->header('X-Catalyst-Executed'),
- join(", ",
+ is( $response->header('X-Catalyst-Executed'),
+ join(", ",
qw[
TestApp::Controller::Action::Chained->begin
TestApp::Controller::Action::Chained::ArgsOrder->base
])
);
is( $response->content, 'base; ; all; X', 'Content OK' );
-
+
}
#
is( $response->header('X-Catalyst-Executed'),
$expected, 'Executed actions' );
}
-
+
#
# */search
# doc/*
- #
+ #
# request for doc/search should end up in doc/*
{
my @expected = qw[