Add failing tests for OPTIONS
[catagits/Catalyst-Action-REST.git] / t / lib / Test / Catalyst / Action / REST / Controller / REST.pm
index 49d0cd1..ad168c1 100644 (file)
@@ -1,9 +1,9 @@
 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 ) = @_;
@@ -20,9 +20,31 @@ sub test_status_created : Local {
     );
 }
 
+sub test_status_multiple_choices : Local {
+    my ( $self, $c ) = @_;
+    $self->status_multiple_choices(
+        $c,
+        location => '/rest/choice1',
+        entity   => { choices => [qw(/rest/choice1 /rest/choice2)] }
+    );
+}
+
+sub test_status_found : Local {
+    my ( $self, $c ) = @_;
+    $self->status_found(
+        $c,
+        location => '/rest',
+        entity   => { status => 'found' },
+    );
+}
+
 sub test_status_accepted : Local {
     my ( $self, $c ) = @_;
-    $self->status_accepted( $c, entity => { status => "queued", } );
+    $self->status_accepted(
+        $c,
+        location => '/rest',
+        entity => { status => "queued", }
+    );
 }
 
 sub test_status_no_content : Local {
@@ -36,6 +58,12 @@ sub test_status_bad_request : Local {
         message => "Cannot do what you have asked!", );
 }
 
+sub test_status_forbidden : Local {
+    my ( $self, $c ) = @_;
+    $self->status_forbidden ( $c,
+        message => "access denied", );
+}
+
 sub test_status_not_found : Local {
     my ( $self, $c ) = @_;
     $self->status_not_found( $c,
@@ -48,4 +76,11 @@ sub test_status_gone : Local {
         message => "Document have been deleted by foo", );
 }
 
+sub opts : Local ActionClass('REST') {}
+
+sub opts_GET {
+    my ( $self, $c ) = @_;
+    $self->status_ok( $c, entity => { opts => 'worked' } );
+}
+
 1;