From: Dan Dascalescu Date: Tue, 16 Jun 2009 01:02:52 +0000 (-0700) Subject: Made test independent of YAML::Syck bugs X-Git-Tag: 0.75~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Action-REST.git;a=commitdiff_plain;h=f10644864a543bf49bb2473c0809e376f9ec1fb4;hp=21d3f6aeb5d5150d2709f9a3d0647d21e9d74d9b Made test independent of YAML::Syck bugs --- diff --git a/t/catalyst-action-serialize-accept.t b/t/catalyst-action-serialize-accept.t index bea3d3a..8b9408f 100644 --- a/t/catalyst-action-serialize-accept.t +++ b/t/catalyst-action-serialize-accept.t @@ -6,16 +6,17 @@ use FindBin; use lib ("$FindBin::Bin/lib", "$FindBin::Bin/../lib", "$FindBin::Bin/broken"); use Test::Rest; +use Catalyst::Action::Serialize::YAML; # Should use Data::Dumper, via YAML my $t = Test::Rest->new('content_type' => 'text/x-yaml'); use_ok 'Catalyst::Test', 'Test::Catalyst::Action::REST'; -my $data = <serialize({lou => 'is my cat'}); { my $req = $t->get(url => '/serialize/test'); @@ -29,7 +30,7 @@ EOH $res->content =~ m#Content-Type text/x-yaml is not supported# ); ok( $res->is_success, 'GET the serialized request succeeded' ); - is( $res->content, $data, "Request returned proper data"); + is( $res->content, $output_YAML, "Request returned proper data"); is( $res->header('Content-type'), 'text/x-yaml', '... with expected content-type') }; @@ -49,31 +50,31 @@ SKIP: { is( $res->header('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 default -# serializer (rt.cpan.org ticket 27949) +# Make sure we don't get a bogus content-type when using the default +# serializer (https://rt.cpan.org/Ticket/Display.html?id=27949) { my $req = $t->get(url => '/serialize/test'); $req->remove_header('Content-Type'); $req->header('Accept', '*/*'); my $res = request($req); ok( $res->is_success, 'GET the serialized request succeeded' ); - is( $res->content, $data, "Request returned proper data"); + is( $res->content, $output_YAML, "Request returned proper data"); is( $res->header('Content-type'), 'text/x-yaml', '... with expected content-type') } -# Make that using content_type_stash_key, an invalid value in the stash gets ignored +# Make sure that when using content_type_stash_key, an invalid value in the stash gets ignored { my $req = $t->get(url => '/serialize/test_second?serialize_content_type=nonesuch'); $req->remove_header('Content-Type'); $req->header('Accept', '*/*'); my $res = request($req); ok( $res->is_success, 'GET the serialized request succeeded' ); - is( $res->content, $data, "Request returned proper data"); + is( $res->content, $output_YAML, "Request returned proper data"); is( $res->header('Content-type'), 'text/x-yaml', '... with expected content-type') } -# Make that using content_type_stash_key, a valid value in the stash gets priority -# this also tests that application-level config is properly passed to +# 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 =>