X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FTest%2FCatalyst%2FAction%2FREST%2FController%2FREST.pm;h=e434159dfbb85355f1b8e0e579e2eed951a76912;hb=930013e6f19b25a090c3f8839495ad8d9b15ff6d;hp=9d75b4d67d0ffbac741f7189835b0534432c6594;hpb=0ba737212e82994202544ac6fb61f6d0ffb96184;p=catagits%2FCatalyst-Action-REST.git diff --git a/t/lib/Test/Catalyst/Action/REST/Controller/REST.pm b/t/lib/Test/Catalyst/Action/REST/Controller/REST.pm index 9d75b4d..e434159 100644 --- a/t/lib/Test/Catalyst/Action/REST/Controller/REST.pm +++ b/t/lib/Test/Catalyst/Action/REST/Controller/REST.pm @@ -1,13 +1,51 @@ package Test::Catalyst::Action::REST::Controller::REST; -use strict; -use warnings; +use Moose; +use namespace::autoclean; -use base 'Catalyst::Controller::REST'; +BEGIN { extends 'Catalyst::Controller::REST' } sub test : Local { - my ($self, $c) = @_; - $self->status_ok($c, entity => { test => 'worked', data => $c->req->data }); + my ( $self, $c ) = @_; + $self->status_ok( $c, + entity => { test => 'worked', data => $c->req->data } ); +} + +sub test_status_created : Local { + my ( $self, $c ) = @_; + $self->status_created( + $c, + location => '/rest', + entity => { status => 'created' } + ); +} + +sub test_status_accepted : Local { + my ( $self, $c ) = @_; + $self->status_accepted( $c, entity => { status => "queued", } ); +} + +sub test_status_no_content : Local { + my ( $self, $c ) = @_; + $self->status_no_content($c); +} + +sub test_status_bad_request : Local { + my ( $self, $c ) = @_; + $self->status_bad_request( $c, + message => "Cannot do what you have asked!", ); +} + +sub test_status_not_found : Local { + my ( $self, $c ) = @_; + $self->status_not_found( $c, + message => "Cannot find what you were looking for!", ); +} + +sub test_status_gone : Local { + my ( $self, $c ) = @_; + $self->status_gone( $c, + message => "Document have been deleted by foo", ); } 1;