failing test cases
John Napiorkowski [Tue, 24 Mar 2015 15:04:28 +0000 (10:04 -0500)]
lib/Catalyst/ActionRole/HTTPMethods.pm
t/arg_constraints.t

index a67d629..d0ee99c 100644 (file)
@@ -4,14 +4,7 @@ use Moose::Role;
 
 requires 'match', 'match_captures', 'list_extra_info';
 
-around ['match','match_captures'] => sub {
-  my ($orig, $self, $ctx, @args) = @_;
-  my $expected = $ctx->req->method;
-  return $self->_has_expected_http_method($expected) ?
-    $self->$orig($ctx, @args) :
-    0;
-};
-
+sub allowed_http_methods { @{shift->attributes->{Method}||[]} }
 
 sub _has_expected_http_method {
   my ($self, $expected) = @_;
@@ -20,7 +13,14 @@ sub _has_expected_http_method {
     1 : 0;
 }
 
-sub allowed_http_methods { @{shift->attributes->{Method}||[]} }
+around ['match','match_captures'] => sub {
+  my ($orig, $self, $ctx, @args) = @_;
+  return 0 unless $self->$orig($ctx, @args);
+
+  my $expected = $ctx->req->method;
+  warn $expected;
+  return $self->_has_expected_http_method($expected);
+};
 
 around 'list_extra_info' => sub {
   my ($orig, $self, @args) = @_;
index a1cd3fd..8d74aa8 100644 (file)
@@ -141,10 +141,11 @@ BEGIN {
 
   sub chain_base2 :Chained(/) CaptureArgs(1) { }
 
-    sub chained_zero_post2 :POST Chained(chain_base2) PathPart('') Args(0) { $_[1]->res->body('chained_zero_post2') }
+    sub chained_zero_again : Chained(chain_base2) PathPart('') Args(0) { $_[1]->res->body('chained_zero_again') }
+    sub chained_zero_post2 : Chained(chain_base2) PathPart('') Args(0) { $_[1]->res->body('chained_zero_post2') }
     sub chained_zero2      :     Chained(chain_base2) PathPart('') Args(0) { $_[1]->res->body('chained_zero2') }
 
-    sub chained_zero_post3 :POST Chained(chain_base2) PathPart('') Args(1) { $_[1]->res->body('chained_zero_post3') }
+    sub chained_zero_post3 : Chained(chain_base2) PathPart('') Args(1) { $_[1]->res->body('chained_zero_post3') }
     sub chained_zero3      :     Chained(chain_base2) PathPart('') Args(1) { $_[1]->res->body('chained_zero3') }
 
 
@@ -321,43 +322,35 @@ SKIP: {
   is $res->content, 'finally2';
 }
 
-=over
-
-| /chain_base/*                                               | /chain_base (1)                                             |
-|                                                             | => /chained_zero (0)                                        |
-| /chain_base/*                                               | /chain_base (1)                                             |
-|                                                             | => POST /chained_zero_post (0)                              
-
-=cut
 
 {
     my $res = request PUT '/chain_base2/capture/1';
-    is $res->content, 'chained_zero3';
+    is $res->content, 'chained_zero3', "request PUT '/chain_base2/capture/1'";
 }
 
 {
     my $res = request '/chain_base2/capture/1';
-    is $res->content, 'chained_zero3';
+    is $res->content, 'chained_zero3', "request '/chain_base2/capture/1'";
 }
 
 {
     my $res = request POST '/chain_base2/capture/1';
-    is $res->content, 'chained_zero3';
+    is $res->content, 'chained_zero3', "request POST '/chain_base2/capture/1'";
 }
 
 {
     my $res = request PUT '/chain_base2/capture';
-    is $res->content, 'chained_zero2';
+    is $res->content, 'chained_zero2', "request PUT '/chain_base2/capture'";
 }
 
 {
     my $res = request '/chain_base2/capture';
-    is $res->content, 'chained_zero2';
+    is $res->content, 'chained_zero2', "request '/chain_base2/capture'";
 }
 
 {
     my $res = request POST '/chain_base2/capture';
-    is $res->content, 'chained_zero2';
+    is $res->content, 'chained_zero2', "request POST '/chain_base2/capture'";
 }
 
 =over