From: Wallace Reis Date: Mon, 11 Jun 2012 12:35:31 +0000 (+0200) Subject: Add failing tests for OPTIONS X-Git-Tag: 1.08~28 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=802042187288e9fedc2a03965d5b2a775b50f9c9;hp=e566b7c797b76740ac385886bd717c5c82caea77;p=catagits%2FCatalyst-Action-Serialize-Data-Serializer.git Add failing tests for OPTIONS --- diff --git a/t/catalyst-action-rest.t b/t/catalyst-action-rest.t index c7f23a4..124906c 100644 --- a/t/catalyst-action-rest.t +++ b/t/catalyst-action-rest.t @@ -47,6 +47,23 @@ is( $options_res->code, 200, "OPTIONS request handler succeeded" ); is( $options_res->header('allow'), "GET", "OPTIONS request allow header properly set." ); +my $opts_res = request( $t->options( url => '/rest/opts' ) ); +is( $opts_res->code, 200, "OPTIONS request handler succeeded" ); +is( $opts_res->header('allow'), + "GET", "OPTIONS request allow header properly set." ); +is($opts_res->content, q{}, 'should have no body'); + +$opts_res = request( + $t->options( + url => '/rest/opts', + headers => { Accept => 'application/json' }, + ) +); +is( $opts_res->code, 200, "OPTIONS request handler succeeded" ); +is( $opts_res->header('allow'), + "GET", "OPTIONS request allow header properly set." ); +is($opts_res->content, q{}, 'should have no body'); + my $modified_res = request( $t->get( url => '/not_modified' ) ); is( $modified_res->code, 304, "Not Modified request handler succeeded" ); diff --git a/t/lib/Test/Catalyst/Action/REST/Controller/REST.pm b/t/lib/Test/Catalyst/Action/REST/Controller/REST.pm index 63fdea1..ad168c1 100644 --- a/t/lib/Test/Catalyst/Action/REST/Controller/REST.pm +++ b/t/lib/Test/Catalyst/Action/REST/Controller/REST.pm @@ -76,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;