Test-case: When view is set, don't serialize
Shea Levy [Fri, 15 Mar 2013 17:15:22 +0000 (13:15 -0400)]
Signed-off-by: Shea Levy <shea@shealevy.com>

t/catalyst-action-serialize.t
t/lib/Test/Catalyst/Action/REST/Controller/Serialize.pm

index aa62651..2535cfe 100644 (file)
@@ -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;
index 4056898..0fd1592 100644 (file)
@@ -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;