From: Dagfinn Ilmari Mannsåker Date: Mon, 22 Apr 2013 13:33:06 +0000 (+0100) Subject: Use YAML rather than JSON in basic tests X-Git-Tag: 1.10~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Action-REST.git;a=commitdiff_plain;h=81b9fff3b22ae35a62336537466568c7aa54b384 Use YAML rather than JSON in basic tests We have a hard dependency on YAML::Syck, but JSON support is optional, so use YAML in basic functionality test. --- diff --git a/Changes b/Changes index c736e84..bf55d47 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,5 @@ + Use YAML rather than JSON in basic tests + Fri 19 Apr 2013 13:34:38 BST - Release 1.09 Don't load Data::Serializer unnecessarily in tests diff --git a/t/catalyst-action-serialize.t b/t/catalyst-action-serialize.t index bb80329..52b6397 100644 --- a/t/catalyst-action-serialize.t +++ b/t/catalyst-action-serialize.t @@ -7,13 +7,13 @@ use FindBin; use lib ("$FindBin::Bin/lib", "$FindBin::Bin/../lib", "$FindBin::Bin/broken"); use Test::Rest; -my $t = Test::Rest->new('content_type' => 'application/json'); +my $t = Test::Rest->new('content_type' => 'text/x-yaml'); use_ok 'Catalyst::Test', 'Test::Catalyst::Action::REST'; my $res = request($t->get(url => '/serialize/test')); ok( $res->is_success, 'GET the serialized request succeeded' ); -is( $res->content, '{"lou":"is my cat"}', "Request returned proper data"); +is( $res->content, "--- \nlou: is my cat\n", "Request returned proper data"); my $nt = Test::Rest->new('content_type' => 'text/broken'); my $bres = request($nt->get(url => '/serialize/test')); @@ -27,16 +27,16 @@ is ($bres->code, 415, 'GET on unknown Content-Type returns 415'); # request. my $res2 = request($t->get(url => '/serialize/test_second')); ok( $res2->is_success, '2nd request succeeded' ); -is( $res2->content,'{"lou":"is my cat"}', "2nd request returned proper data"); +is( $res2->content, "--- \nlou: is my cat\n", "request returned proper data"); -Test::Catalyst::Action::REST->controller('Serialize')->{serialize} = {}; +Test::Catalyst::Action::REST->controller('Serialize')->{serialize} = { }; $res2 = request($t->get(url => '/serialize/test_second')); ok( $res2->is_success, 'request succeeded (deprecated config)' ); -is( $res2->content,'{"lou":"is my cat"}', "request returned proper data"); +is( $res2->content, "--- \nlou: is my cat\n", "request returned proper data"); $res = request($t->get(url => '/serialize/empty_serialized')); -is $res->content, q[{"foo":"bar"}], 'normal case ok'; +is $res->content, "--- \nfoo: bar\n", 'normal case ok'; ok $res->header('Content-Length'), 'set content-length when we serialize'; $res = request($t->get(url => '/serialize/empty_not_serialized_blank'));