X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FTest%2FCatalyst%2FAction%2FREST%2FController%2FActions.pm;h=905b700c195a0896107dee4d4dbae18e0dc18dd5;hb=9e4398c862fc57d6f9d83f9c64ab3e5e858b9862;hp=39a04a5415add3465a28682afa75f3fca15fb9fe;hpb=07b2ce2791d17c5779b1181bb77fc41d446e85e8;p=catagits%2FCatalyst-Action-REST.git diff --git a/t/lib/Test/Catalyst/Action/REST/Controller/Actions.pm b/t/lib/Test/Catalyst/Action/REST/Controller/Actions.pm index 39a04a5..905b700 100644 --- a/t/lib/Test/Catalyst/Action/REST/Controller/Actions.pm +++ b/t/lib/Test/Catalyst/Action/REST/Controller/Actions.pm @@ -1,92 +1,80 @@ package Test::Catalyst::Action::REST::Controller::Actions; -use strict; -use warnings; +use Moose; +use namespace::autoclean; -use base qw/Catalyst::Controller::REST/; +BEGIN { extends qw/Catalyst::Controller::REST/ } -__PACKAGE__->config( namespace => 'actions' ); +__PACKAGE__->_action_class('Test::Action::Class'); sub begin {} # Don't need serialization.. -sub test : Local : ActionClass('REST') { +sub test : Local : ActionClass('+Catalyst::Action::REST') { my ( $self, $c ) = @_; - $c->stash->{'entity'} = 'something'; + $c->res->header('X-Was-In-TopLevel', 1); } -sub test_GET : Private ActionClass('+Test::Action::Class') { +sub test_GET : Private { my ( $self, $c ) = @_; - - $c->stash->{'entity'} .= " GET"; - $c->forward('ok'); + $c->res->body('GET'); } -sub test_POST :ActionClass('+Test::Action::Class') { +sub test_POST : Action { my ( $self, $c ) = @_; - - $c->stash->{'entity'} .= " POST"; - $c->forward('ok'); + $c->res->body('POST'); } -sub test_PUT :ActionClass('+Test::Action::Class') { +sub test_PUT :ActionClass('+Test::Action::Class::Sub') { my ( $self, $c ) = @_; - - $c->stash->{'entity'} .= " PUT"; - $c->forward('ok'); + $c->res->body('PUT'); } -sub test_DELETE :ActionClass('+Test::Action::Class') { +sub test_DELETE : Local { my ( $self, $c ) = @_; - $c->stash->{'entity'} .= " DELETE"; - $c->forward('ok'); + $c->res->body('DELETE'); } -sub test_OPTIONS :ActionClass('+Test::Action::Class') { +sub test_OPTIONS : Path('foobar') { my ( $self, $c ) = @_; - $c->stash->{'entity'} .= " OPTIONS"; - $c->forward('ok'); + $c->res->body('OPTIONS'); } -sub notreally : Local : ActionClass('REST') { +sub other_test :Local :ActionClass('+Catalyst::Action::REST') { + my ( $self, $c ) = @_; + $c->res->header('X-Was-In-TopLevel', 1); } -sub notreally_GET :ActionClass('+Test::Action::Class') { +sub other_test_GET { my ( $self, $c ) = @_; - - $c->stash->{'entity'} = "notreally GET"; - $c->forward('ok'); + $c->res->body('GET'); } -sub not_implemented : Local : ActionClass('REST') { +sub other_test_POST { + my ( $self, $c ) = @_; + $c->res->body('POST'); } -sub not_implemented_GET :ActionClass('+Test::Action::Class') { +sub other_test_PUT :ActionClass('+Test::Action::Class::Sub') { my ( $self, $c ) = @_; - - $c->stash->{'entity'} = "not_implemented GET"; - $c->forward('ok'); + $c->res->body('PUT'); } -sub not_implemented_not_implemented :ActionClass('+Test::Action::Class') { +sub other_test_DELETE { my ( $self, $c ) = @_; - - $c->stash->{'entity'} = "Not Implemented Handler"; - $c->forward('ok'); + $c->res->body('DELETE'); } -sub not_modified : Local : ActionClass('REST') { } - -sub not_modified_GET { +sub other_test_OPTIONS { my ( $self, $c ) = @_; - $c->res->status(304); - return 1; + + $c->res->body('OPTIONS'); } -sub ok : Private { - my ( $self, $c ) = @_; +sub yet_other_test : Local : ActionClass('+Catalyst::Action::REST') {} - $c->res->content_type('text/plain'); - $c->res->body( $c->stash->{'entity'} ); +sub yet_other_test_POST { + my ( $self, $c ) = @_; + $c->res->body('POST'); } sub end : Private {} # Don't need serialization..