X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Faggregate%2Flive_component_controller_action_auto.t;h=01bdfe42d43049c445ba222264fdfbdabc28d348;hb=03e89d2c39c919833f58675f7c62d622673c2308;hp=bf566dc0990535f8c9b6375bb060e476ff8fa15a;hpb=ae29b412955743885e80350085167b54b69672da;p=catagits%2FCatalyst-Runtime.git diff --git a/t/aggregate/live_component_controller_action_auto.t b/t/aggregate/live_component_controller_action_auto.t index bf566dc..01bdfe4 100644 --- a/t/aggregate/live_component_controller_action_auto.t +++ b/t/aggregate/live_component_controller_action_auto.t @@ -10,7 +10,7 @@ our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } -use Test::More tests => 18*$iters; +use Test::More tests => 27*$iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { @@ -35,7 +35,7 @@ sub run_tests { TestApp::Controller::Action::Auto->begin TestApp::Controller::Action::Auto->auto TestApp::Controller::Action::Auto->one - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); @@ -52,7 +52,7 @@ sub run_tests { TestApp::Controller::Action::Auto->begin TestApp::Controller::Action::Auto->auto TestApp::Controller::Action::Auto->default - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); @@ -70,7 +70,7 @@ sub run_tests { TestApp::Controller::Action::Auto->auto TestApp::Controller::Action::Auto::Deep->auto TestApp::Controller::Action::Auto::Deep->one - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); @@ -88,7 +88,7 @@ sub run_tests { TestApp::Controller::Action::Auto->auto TestApp::Controller::Action::Auto::Deep->auto TestApp::Controller::Action::Auto::Deep->default - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); @@ -133,4 +133,58 @@ sub run_tests { $expected, 'Executed actions' ); is( $response->content, 'default (auto: 1)', 'Content OK' ); } + + # test detach in auto + { + my @expected = qw[ + TestApp::Controller::Action::Auto::Detach->begin + TestApp::Controller::Action::Auto->auto + TestApp::Controller::Action::Auto::Detach->auto + TestApp::Controller::Root->end + ]; + + my $expected = join( ", ", @expected ); + + ok( my $response = request('http://localhost/action/auto/detach'), 'auto with detach' ); + is( $response->header('X-Catalyst-Executed'), + $expected, 'Executed actions' ); + is( $response->content, 'detach auto', 'Content OK' ); + } + + # test detach in auto forward + { + my @expected = qw[ + TestApp::Controller::Action::Auto::Detach->begin + TestApp::Controller::Action::Auto->auto + TestApp::Controller::Action::Auto::Detach->auto + TestApp::Controller::Action::Auto::Detach->with_forward_detach + TestApp::Controller::Root->end + ]; + + my $expected = join( ", ", @expected ); + + ok( my $response = request('http://localhost/action/auto/detach?with_forward_detach=1'), 'auto with_forward_detach' ); + is( $response->header('X-Catalyst-Executed'), + $expected, 'Executed actions' ); + is( $response->content, 'detach with_forward_detach', 'Content OK' ); + } + + # test detach in auto forward detach action + { + my @expected = qw[ + TestApp::Controller::Action::Auto::Detach->begin + TestApp::Controller::Action::Auto->auto + TestApp::Controller::Action::Auto::Detach->auto + TestApp::Controller::Action::Auto::Detach->with_forward_detach + TestApp::Controller::Action::Auto::Detach->detach_action + TestApp::Controller::Root->end + ]; + + my $expected = join( ", ", @expected ); + + ok( my $response = request('http://localhost/action/auto/detach?with_forward_detach=1&detach_to_action=1'), 'auto with_forward_detach to detach_action' ); + is( $response->header('X-Catalyst-Executed'), + $expected, 'Executed actions' ); + is( $response->content, 'detach_action', 'Content OK' ); + } }