From: John Napiorkowski Date: Tue, 24 Mar 2015 15:04:28 +0000 (-0500) Subject: failing test cases X-Git-Tag: 5.90089_002~28 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=70949f28d6d56c8c882cd937b9c3be5e04aaba62 failing test cases --- diff --git a/lib/Catalyst/ActionRole/HTTPMethods.pm b/lib/Catalyst/ActionRole/HTTPMethods.pm index a67d629..d0ee99c 100644 --- a/lib/Catalyst/ActionRole/HTTPMethods.pm +++ b/lib/Catalyst/ActionRole/HTTPMethods.pm @@ -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) = @_; diff --git a/t/arg_constraints.t b/t/arg_constraints.t index a1cd3fd..8d74aa8 100644 --- a/t/arg_constraints.t +++ b/t/arg_constraints.t @@ -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