render support.
[catagits/Catalyst-View-TT.git] / t / lib / TestApp.pm
index 7a823ce..0220d93 100755 (executable)
@@ -51,19 +51,24 @@ sub test_includepath : Local {
 }
 
 sub test_render : Local {
-       my ($self, $c) = @_;
+    my ($self, $c) = @_;
 
-       $c->stash->{message} = $c->view('TT')->render($c, $c->req->param('template'), {param => $c->req->param('param')});
-       $c->stash->{template} = 'test.tt';
+    my $out = $c->stash->{message} = $c->view('TT')->render($c, $c->req->param('template'), {param => $c->req->param('param') || ''});
+    if (UNIVERSAL::isa($out, 'Template::Exception')) {
+        $c->response->body($out);
+        $c->response->status(403);
+    } else {
+        $c->stash->{template} = 'test.tt';
+    }
 
 }
 
 sub test_msg : Local {
-       my ($self, $c) = @_;
-       my $tmpl = $c->req->param('msg');
-       
-       $c->stash->{message} = $c->view('TT')->render($c, \$tmpl);
-       $c->stash->{template} = 'test.tt';
+    my ($self, $c) = @_;
+    my $tmpl = $c->req->param('msg');
+    
+    $c->stash->{message} = $c->view('TT')->render($c, \$tmpl);
+    $c->stash->{template} = 'test.tt';
 }
 
 sub end : Private {