From: Shea Levy Date: Fri, 15 Mar 2013 17:15:22 +0000 (-0400) Subject: Test-case: When view is set, don't serialize X-Git-Tag: 1.07~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Action-REST.git;a=commitdiff_plain;h=fb9d509bd44b46cb5b67d3aeb501dc5246b760e1 Test-case: When view is set, don't serialize Signed-off-by: Shea Levy --- diff --git a/t/catalyst-action-serialize.t b/t/catalyst-action-serialize.t index aa62651..2535cfe 100644 --- a/t/catalyst-action-serialize.t +++ b/t/catalyst-action-serialize.t @@ -45,4 +45,8 @@ $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"; +$res = request($t->get(url => '/serialize/explicit_view')); +is $res->content, '', "view explicitly set to '' results in '' content"; +ok !$res->header('Content-Length'), "view explicitly set to '' - no automatic content-length"; + done_testing; diff --git a/t/lib/Test/Catalyst/Action/REST/Controller/Serialize.pm b/t/lib/Test/Catalyst/Action/REST/Controller/Serialize.pm index 4056898..0fd1592 100644 --- a/t/lib/Test/Catalyst/Action/REST/Controller/Serialize.pm +++ b/t/lib/Test/Catalyst/Action/REST/Controller/Serialize.pm @@ -48,4 +48,10 @@ sub empty_not_serialized_blank :Chained('empty') Args(0) ActionClass('Serialize' $c->res->body(''); } +# Explicitly set a view +sub explicit_view :Chained('empty') Args(0) ActionClass('Serialize') { + my ($self, $c) = @_; + $c->stash->{current_view} = ''; +} + 1;