From: Marcus Ramberg Date: Thu, 14 Apr 2005 12:59:28 +0000 (+0000) Subject: added tests for forward to global private actions. X-Git-Tag: 5.7099_04~1541 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=2656a6de4f7828fdf37ac8c57a6fc218bdfa93d4 added tests for forward to global private actions. --- diff --git a/t/component/controller/action/forward.t b/t/component/controller/action/forward.t index 273d00f..a031eee 100644 --- a/t/component/controller/action/forward.t +++ b/t/component/controller/action/forward.t @@ -23,7 +23,13 @@ use Catalyst::Test 'TestApp'; my $expected = join( ", ", @expected ); - ok( my $response = request('http://localhost/action/forward/one'), 'Request' ); + # Test forward to global private action + ok( my $response = request('http://localhost/main_action'), 'Request' ); + ok( $response->is_success, 'Response Successful 2xx' ); + is( $response->content_type, 'text/plain', 'Response Content-Type' ); + is( $response->header('X-Catalyst-Action'), 'main_action', 'Main Class Action' ); + # Test forward to chain of actions. + ok( $response = request('http://localhost/action/forward/one'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action/forward/one', 'Test Action' ); diff --git a/t/component/controller/action/absolute.t b/t/component/controller/action/global.t similarity index 100% rename from t/component/controller/action/absolute.t rename to t/component/controller/action/global.t diff --git a/t/component/controller/action/relative.t b/t/component/controller/action/local.t similarity index 100% rename from t/component/controller/action/relative.t rename to t/component/controller/action/local.t diff --git a/t/lib/TestApp.pm b/t/lib/TestApp.pm index e7f2ae2..eae7b07 100644 --- a/t/lib/TestApp.pm +++ b/t/lib/TestApp.pm @@ -14,6 +14,11 @@ TestApp->setup; #sub execute { return shift->NEXT::execute(@_); } # does not work, bug? +sub main_action : Private { + my ( $self, $c ) = @_; + $c->forward('TestApp::View::Dump::Request'); +} + sub execute { my $c = shift; my $class = ref( $c->component($_[0]) ) || $_[0];