oh my god, its full of tiny version numbers
[catagits/Catalyst-Action-REST.git] / t / lib / Test / Catalyst / Action / REST / Controller / REST.pm
index f9f7147..08bcdf0 100644 (file)
@@ -5,6 +5,12 @@ use namespace::autoclean;
 
 BEGIN { extends 'Catalyst::Controller::REST' }
 
+__PACKAGE__->config(
+  'map' => {
+    'text/html'          => 'YAML::HTML',
+    'text/x-yaml'        => 'YAML',
+});
+
 sub test : Local {
     my ( $self, $c ) = @_;
     $self->status_ok( $c,
@@ -29,9 +35,22 @@ sub test_status_multiple_choices : Local {
     );
 }
 
+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 {
@@ -45,6 +64,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,
@@ -57,4 +82,18 @@ 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' } );
+}
+
+sub opts_not_implemented {
+    my ( $self, $c ) = @_;
+    $c->res->status(405);
+    $c->res->header('Allow' => [qw(GET HEAD)]);
+    $c->res->body('Not implemented');
+}
+
 1;