BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
-use Test::More tests => 50 * $iters;
+use Test::More tests => 54 * $iters;
+use Catalyst;
use Catalyst::Test 'TestApp';
if ( $ENV{CAT_BENCHMARK} ) {
TestApp::Controller::Action::Go->four
TestApp::Controller::Action::Go->five
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
@expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
my @expected = qw[
TestApp::Controller::Action::Go->go_die
TestApp::Controller::Action::Go->args
- TestApp->end
+ TestApp::Controller::Root->end
];
@expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
$expected, 'Executed actions' );
is( $response->content, $Catalyst::GO, "Go died as expected" );
}
-
+ {
+ ok(
+ my $response = request('http://localhost/action/go/model'),
+ 'Request with args'
+ );
+ is( $response->content,
+ q[FATAL ERROR: Couldn't go("Model::Foo"): Action cannot _DISPATCH. Did you try to go() a non-controller action?],
+ q[go('Model::...') test]
+ );
+ }
+ {
+ ok(
+ my $response = request('http://localhost/action/go/view'),
+ 'Request with args'
+ );
+ is( $response->content,
+ q[FATAL ERROR: Couldn't go("View::Dump"): Action cannot _DISPATCH. Did you try to go() a non-controller action?],
+ q[go('View::...') test]
+ );
+ }
{
ok(
my $response =
'Request with args'
);
ok( $response->is_success, 'Response Successful 2xx' );
- is( $response->content, 'old' );
+ is( $response->content, 'old', 'go() with args (old)' );
}
{
'Request with args and method'
);
ok( $response->is_success, 'Response Successful 2xx' );
- is( $response->content, 'new' );
+ is( $response->content, 'new', 'go() with args (new)' );
}
# test go with embedded args
'Request'
);
ok( $response->is_success, 'Response Successful 2xx' );
- is( $response->content, 'ok' );
+ is( $response->content, 'ok', 'go() with args_embed_relative' );
}
{
'Request'
);
ok( $response->is_success, 'Response Successful 2xx' );
- is( $response->content, 'ok' );
+ is( $response->content, 'ok', 'go() with args_embed_absolute' );
}
{
my @expected = qw[
TestApp::Controller::Action::Go->four
TestApp::Controller::Action::Go->five
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
@expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
TestApp::Controller::Action::Go->four
TestApp::Controller::Action::Go->five
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
@expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
'Request'
);
ok( !$response->is_success, 'Response Fails' );
- is( $response->content, q(FATAL ERROR: Couldn't go to command "TestApp": Invalid action or component.), 'Error message' );
+ 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'
+ );
}
{
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, '; 1', 'Content OK' );
+ is( $response->content, 'captureme; arg1, arg2', 'Content OK' );
}
}