X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fcatalyst-action-rest.t;h=324df80cba7285e0f0a77f0092fc6ca14a5ff338;hb=fcc4f3f2aacf9cded4523f06c7e08f67573c6b8d;hp=825dca436269f691c43ffecf8ff2ba129625bc63;hpb=d34635d1f87b7a53a522583fc6c91e76062709fd;p=catagits%2FCatalyst-Action-REST.git diff --git a/t/catalyst-action-rest.t b/t/catalyst-action-rest.t index 825dca4..324df80 100644 --- a/t/catalyst-action-rest.t +++ b/t/catalyst-action-rest.t @@ -1,109 +1,7 @@ -package Test::Catalyst::Action::REST; - -use FindBin; - -use lib ("$FindBin::Bin/../lib"); - use strict; use warnings; - -use Catalyst::Runtime '5.70'; - -use Catalyst; - -__PACKAGE__->config( name => 'Test::Catalyst::Action::REST' ); -__PACKAGE__->setup; - -sub test : Local : ActionClass('REST') { - my ( $self, $c ) = @_; - $c->stash->{'entity'} = 'something'; -} - -sub test_GET : Local : ActionClass('REST') { - my ( $self, $c ) = @_; - - $c->stash->{'entity'} .= " GET"; - $c->forward('ok'); -} - -sub test_POST : Local : ActionClass('REST') { - my ( $self, $c ) = @_; - - $c->stash->{'entity'} .= " POST"; - $c->forward('ok'); -} - -sub test_PUT : Local : ActionClass('REST') { - my ( $self, $c ) = @_; - - $c->stash->{'entity'} .= " PUT"; - $c->forward('ok'); -} - -sub test_DELETE : Local : ActionClass('REST') { - my ( $self, $c ) = @_; - - $c->stash->{'entity'} .= " DELETE"; - $c->forward('ok'); -} - -sub test_OPTIONS : Local : ActionClass('REST') { - my ( $self, $c ) = @_; - - $c->stash->{'entity'} .= " OPTIONS"; - $c->forward('ok'); -} - -sub notreally : Local : ActionClass('REST') { -} - -sub notreally_GET { - my ( $self, $c ) = @_; - - $c->stash->{'entity'} = "notreally GET"; - $c->forward('ok'); -} - -sub not_implemented : Local : ActionClass('REST') { -} - -sub not_implemented_GET { - my ( $self, $c ) = @_; - - $c->stash->{'entity'} = "not_implemented GET"; - $c->forward('ok'); -} - -sub not_implemented_not_implemented { - my ( $self, $c ) = @_; - - $c->stash->{'entity'} = "Not Implemented Handler"; - $c->forward('ok'); -} - -sub not_modified : Local : ActionClass('REST') { } - -sub not_modified_GET { - my ( $self, $c ) = @_; - $c->res->status(304); - return 1; -} - - -sub ok : Private { - my ( $self, $c ) = @_; - - $c->res->content_type('text/plain'); - $c->res->body( $c->stash->{'entity'} ); -} - -package main; - -use strict; -use warnings; -use Test::More tests => 18; +use Test::More; use FindBin; -use Data::Dump qw(dump); use lib ( "$FindBin::Bin/lib", "$FindBin::Bin/../lib" ); use Test::Rest; @@ -123,7 +21,7 @@ foreach my $method (qw(GET DELETE POST PUT OPTIONS)) { $res = request( $t->$run_method( url => '/test', - data => { foo => 'bar' } + data => '', ) ); } @@ -156,3 +54,5 @@ is( ); 1; + +done_testing;