View::TT, added tests from dwc
[catagits/Catalyst-View-TT.git] / t / lib / TestApp.pm
CommitLineData
07571b2f 1package TestApp;
2
3use strict;
4use warnings;
5
6use Catalyst; # qw/-Debug/;
7
8our $VERSION = '0.01';
9
10__PACKAGE__->config(
11 name => 'TestApp',
12 default_message => 'hi',
13 default_view => 'Pkgconfig',
14 'View::TT::Appconfig' => {
15 PRE_CHOMP => 1,
16 POST_CHOMP => 1,
17 TEMPLATE_EXTENSION => '.tt',
18 },
19);
20
21__PACKAGE__->setup;
22
23sub default : Private {
24 my ($self, $c) = @_;
25
26 $c->response->redirect($c->uri_for('test'));
27}
28
29sub test : Local {
30 my ($self, $c) = @_;
31
32 $c->stash->{message} = ($c->request->param('message') || $c->config->{default_message});
33}
34
35sub end : Private {
36 my ($self, $c) = @_;
37
38 return 1 if $c->response->status =~ /^3\d\d$/;
39 return 1 if $c->response->body;
40
41 my $view = 'View::TT::' . ($c->request->param('view') || $c->config->{default_view});
42 $c->forward($view);
43}
44
451;