From: t0m Date: Mon, 29 Jun 2009 21:29:23 +0000 (+0100) Subject: Rip the testapp embedded in the test out, this isn't supported and doesn't work for me X-Git-Tag: fixes_5_80_forward_stats_warnings~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Action-REST.git;a=commitdiff_plain;h=501578043bb885a3383d99b818ff2faeb7a334d5 Rip the testapp embedded in the test out, this isn't supported and doesn't work for me --- diff --git a/t/catalyst-action-rest.t b/t/catalyst-action-rest.t index b65fa1f..535ac4e 100644 --- a/t/catalyst-action-rest.t +++ b/t/catalyst-action-rest.t @@ -1,104 +1,3 @@ -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; @@ -122,7 +21,7 @@ foreach my $method (qw(GET DELETE POST PUT OPTIONS)) { $res = request( $t->$run_method( url => '/test', - data => { foo => 'bar' } + data => '', ) ); } diff --git a/t/lib/Test/Catalyst/Action/REST/Controller/Root.pm b/t/lib/Test/Catalyst/Action/REST/Controller/Root.pm new file mode 100644 index 0000000..1ebbee6 --- /dev/null +++ b/t/lib/Test/Catalyst/Action/REST/Controller/Root.pm @@ -0,0 +1,96 @@ +package Test::Catalyst::Action::REST::Controller::Root; +use strict; +use warnings; + +use base qw/Catalyst::Controller::REST/; + +__PACKAGE__->config( namespace => '' ); + +sub begin {} # Don't need serialization.. + +sub test : Local : ActionClass('REST') { + my ( $self, $c ) = @_; + $c->stash->{'entity'} = 'something'; +} + +sub test_GET { + my ( $self, $c ) = @_; + + $c->stash->{'entity'} .= " GET"; + $c->forward('ok'); +} + +sub test_POST { + my ( $self, $c ) = @_; + + $c->stash->{'entity'} .= " POST"; + $c->forward('ok'); +} + +sub test_PUT { + my ( $self, $c ) = @_; + + $c->stash->{'entity'} .= " PUT"; + $c->forward('ok'); +} + +sub test_DELETE { + my ( $self, $c ) = @_; + + $c->stash->{'entity'} .= " DELETE"; + $c->forward('ok'); +} + +sub test_OPTIONS { + 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'} ); +} + +sub end : Private {} # Don't need serialization.. + +1; +