X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fcatalyst-action-serialize-accept.t;h=8f5a38f469467f21a4be192dad16f5125ff9d8e0;hb=6faec9b3dab80cfa9c284cf8b688f25c0a1736ca;hp=64732f510892e5af70edb5730860713c9662ab34;hpb=960e29eed9ccd049c3c0dcd78a65308242a64ae0;p=catagits%2FCatalyst-Action-REST.git diff --git a/t/catalyst-action-serialize-accept.t b/t/catalyst-action-serialize-accept.t index 64732f5..8f5a38f 100644 --- a/t/catalyst-action-serialize-accept.t +++ b/t/catalyst-action-serialize-accept.t @@ -1,8 +1,8 @@ use strict; use warnings; use Test::More; -use Data::Serializer; use FindBin; +use Test::Requires qw(YAML::Syck); use lib ("$FindBin::Bin/lib", "$FindBin::Bin/../lib", "$FindBin::Bin/broken"); use Test::Rest; @@ -31,7 +31,7 @@ my $output_YAML = Catalyst::Action::Serialize::YAML->serialize({lou => 'is my ca ); ok( $res->is_success, 'GET the serialized request succeeded' ); is( $res->content, $output_YAML, "Request returned proper data"); - is( $res->header('Content-type'), 'text/x-yaml', '... with expected content-type') + is( $res->content_type, 'text/x-yaml', '... with expected content-type') }; } @@ -47,7 +47,7 @@ SKIP: { ok( $res->is_success, 'GET the serialized request succeeded' ); my $ret = $json->decode($res->content); is( $ret->{lou}, 'is my cat', "Request returned proper data"); - is( $res->header('Content-type'), 'application/json', 'Accept header used if content-type mapping not found') + is( $res->content_type, 'application/json', 'Accept header used if content-type mapping not found') }; # Make sure we don't get a bogus content-type when using the default @@ -59,7 +59,7 @@ SKIP: { my $res = request($req); ok( $res->is_success, 'GET the serialized request succeeded' ); is( $res->content, $output_YAML, "Request returned proper data"); - is( $res->header('Content-type'), 'text/x-yaml', '... with expected content-type') + is( $res->content_type, 'text/x-yaml', '... with expected content-type') } # Make sure that when using content_type_stash_key, an invalid value in the stash gets ignored @@ -70,22 +70,7 @@ SKIP: { my $res = request($req); ok( $res->is_success, 'GET the serialized request succeeded' ); is( $res->content, $output_YAML, "Request returned proper data"); - is( $res->header('Content-type'), 'text/x-yaml', '... with expected content-type') -} - -# Make sure that when using content_type_stash_key, a valid value in the stash gets priority. -# This also tests that application-level config is properly passed to -# individual controllers; see t/lib/Test/Catalyst/Action/REST.pm -{ - my $req = $t->get(url => - '/serialize/test_second?serialize_content_type=text/x-data-dumper' - ); - $req->remove_header('Content-Type'); - $req->header('Accept', '*/*'); - my $res = request($req); - ok( $res->is_success, 'GET the serialized request succeeded' ); - is( $res->content, "{'lou' => 'is my cat'}", "Request returned proper data"); - is( $res->header('Content-type'), 'text/x-data-dumper', '... with expected content-type') + is( $res->content_type, 'text/x-yaml', '... with expected content-type') } # Make sure that the default content type you specify really gets used.