Add tests which should fail, but don't.
[catagits/Catalyst-Action-REST.git] / t / lib / Test / Catalyst / Action / REST / Controller / Actions.pm
index f1b6f23..33b363a 100644 (file)
@@ -1,92 +1,42 @@
 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 :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') {
     my ( $self, $c ) = @_;
-
-    $c->stash->{'entity'} .= " PUT";
-    $c->forward('ok');
-}
-
-sub test_DELETE :ActionClass('+Test::Action::Class') {
-    my ( $self, $c ) = @_;
-    $c->stash->{'entity'} .= " DELETE";
-    $c->forward('ok');
-}
-
-sub test_OPTIONS :ActionClass('+Test::Action::Class') {
-    my ( $self, $c ) = @_;
-
-    $c->stash->{'entity'} .= " OPTIONS";
-    $c->forward('ok');
+    $c->res->body('PUT');
 }
 
-sub notreally : Local : ActionClass('REST') {
-}
-
-sub notreally_GET :ActionClass('+Test::Action::Class') {
-    my ( $self, $c ) = @_;
-
-    $c->stash->{'entity'} = "notreally GET";
-    $c->forward('ok');
-}
-
-sub not_implemented : Local : ActionClass('REST') {
-}
-
-sub not_implemented_GET :ActionClass('+Test::Action::Class') {
-    my ( $self, $c ) = @_;
-
-    $c->stash->{'entity'} = "not_implemented GET";
-    $c->forward('ok');
-}
-
-sub not_implemented_not_implemented :ActionClass('+Test::Action::Class') {
-    my ( $self, $c ) = @_;
-
-    $c->stash->{'entity'} = "Not Implemented Handler";
-    $c->forward('ok');
-}
-
-sub not_modified : Local : ActionClass('REST') { }
-
-sub not_modified_GET {
+sub test_DELETE : Local {
     my ( $self, $c ) = @_;
-    $c->res->status(304);
-    return 1;
+    $c->res->body('DELETE');
 }
 
-sub ok : Private {
+sub test_OPTIONS : Path('foobar') {
     my ( $self, $c ) = @_;
 
-    $c->res->content_type('text/plain');
-    $c->res->body( $c->stash->{'entity'} );
+    $c->res->body('OPTIONS');
 }
 
 sub end : Private {} # Don't need serialization..