X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fcatalyst-action-serialize.t;fp=t%2Fcatalyst-action-serialize.t;h=ffaf23131eed49ba09fba4f538b4d78b25ce5fc3;hb=ad995b48033f9bc3131fe5b34b86db7e2e94f641;hp=43d793d08408e76adf1ed501dbbab109001e996f;hpb=467b1ade0c03900ad39bfdea1ad01bd67cf8f8d8;p=catagits%2FCatalyst-Action-REST.git diff --git a/t/catalyst-action-serialize.t b/t/catalyst-action-serialize.t index 43d793d..ffaf231 100644 --- a/t/catalyst-action-serialize.t +++ b/t/catalyst-action-serialize.t @@ -1,6 +1,7 @@ use strict; use warnings; -use Test::More tests => 11; + +use Test::More 0.88; use Data::Serializer; use FindBin; @@ -35,8 +36,17 @@ $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"); -my $emptyres = request($t->get(url => '/serialize/empty')); -is $emptyres->content, ''; -ok !$emptyres->header('Content-Length'); -1; +$res = request($t->get(url => '/serialize/empty_serialized')); +is $res->content, q[{'foo' => 'bar'}], 'normal case ok'; +ok $res->header('Content-Length'), 'set content-length when we serialize'; + +$res = request($t->get(url => '/serialize/empty_not_serialized_undef')); +is $res->content, '', "body explicitly set to undef results in '' content"; +ok !$res->header('Content-Length'), "body explicitly set to undef - no automatic content-length"; + +$res = request($t->get(url => '/serialize/empty_not_serialized_blank')); +is $res->content, '', "body explicitly set to '' results in '' content"; +ok !$res->header('Content-Length'), "body explicitly set to '' - no automatic content-length"; + +done_testing;