Catalyst-Runtime
view release on metacpan or search on metacpan
t/aggregate/live_component_controller_action_go.t view on Meta::CPAN
TestApp::View::Dump::Request->process
TestApp::Controller::Root->end
];
@expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
my $expected = join( ", ", @expected );
# Test go to chain of actions.
ok(
my $response =
request('http://localhost/action/relative/relative_go_two'),
'Request'
);
ok( $response->is_success, 'Response Successful 2xx' );
is( $response->content_type, 'text/plain', 'Response Content-Type' );
is(
$response->header('X-Catalyst-Action'),
'action/relative/relative_go_two',
'Test Action'
);
is(
$response->header('X-Test-Class'),
'TestApp::Controller::Action::Go',
'Test Class'
);
is( $response->header('X-Catalyst-Executed'),
$expected, 'Executed actions' );
like(
$response->content,
qr/^bless\( .* 'Catalyst::Request' \)$/s,
'Content is a serialized Catalyst::Request'
);
}
# test class go -- MUST FAIL!
{
ok(
my $response = request(
'http://localhost/action/go/class_go_test_action'),
'Request'
);
ok( !$response->is_success, 'Response Fails' );
is( $response->content,
q(FATAL ERROR: Couldn't go("TestApp"): Action has no namespace: cannot go() to a plain method or component, must be an :Action of some sort.),
'Error message'
);
}
{
my @expected = qw[
TestApp::Controller::Action::Go->begin
TestApp::Controller::Action::Go->go_chained
TestApp::Controller::Action::Chained->begin
TestApp::Controller::Action::Chained->foo
TestApp::Controller::Action::Chained::Foo->spoon
TestApp::Controller::Action::Chained->end
];
my $expected = join( ", ", @expected );
ok( my $response = request('http://localhost/action/go/go_chained'), 'go to chained + subcontroller endpoint' );
is( $response->header('X-Catalyst-Executed'),
$expected, 'Executed actions' );
is( $response->content, 'captureme; arg1, arg2', 'Content OK' );
}
}
sub _begin {
local $_ = shift;
s/->(.*)$/->begin/;
return $_;
}
( run in 0.944 second using v1.01-cache-2.11-cpan-39bf76dae61 )