[Catalyst-commits] r6746 - in trunk/Catalyst-View-Mason/t: . lib
lib/TestApp lib/TestApp/View lib/TestApp/View/Mason lib/TestApp/root
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Tue Aug 28 16:58:00 GMT 2007
Author: rafl
Date: 2007-08-28 16:58:00 +0100 (Tue, 28 Aug 2007)
New Revision: 6746
Added:
trunk/Catalyst-View-Mason/t/lib/
trunk/Catalyst-View-Mason/t/lib/TestApp.pm
trunk/Catalyst-View-Mason/t/lib/TestApp/
trunk/Catalyst-View-Mason/t/lib/TestApp/View/
trunk/Catalyst-View-Mason/t/lib/TestApp/View/Mason/
trunk/Catalyst-View-Mason/t/lib/TestApp/View/Mason/Pkgconfig.pm
trunk/Catalyst-View-Mason/t/lib/TestApp/root/
trunk/Catalyst-View-Mason/t/lib/TestApp/root/test
trunk/Catalyst-View-Mason/t/pkgconfig.t
Log:
Add some basic tests.
Added: trunk/Catalyst-View-Mason/t/lib/TestApp/View/Mason/Pkgconfig.pm
===================================================================
--- trunk/Catalyst-View-Mason/t/lib/TestApp/View/Mason/Pkgconfig.pm (rev 0)
+++ trunk/Catalyst-View-Mason/t/lib/TestApp/View/Mason/Pkgconfig.pm 2007-08-28 15:58:00 UTC (rev 6746)
@@ -0,0 +1,11 @@
+package TestApp::View::Mason::Pkgconfig;
+
+use strict;
+use warnings;
+use base 'Catalyst::View::Mason';
+
+__PACKAGE__->config(
+ comp_root => TestApp->path_to('root')->stringify,
+);
+
+1;
Added: trunk/Catalyst-View-Mason/t/lib/TestApp/root/test
===================================================================
--- trunk/Catalyst-View-Mason/t/lib/TestApp/root/test (rev 0)
+++ trunk/Catalyst-View-Mason/t/lib/TestApp/root/test 2007-08-28 15:58:00 UTC (rev 6746)
@@ -0,0 +1,4 @@
+<%args>
+$message
+</%args>
+<% $message %>\
Added: trunk/Catalyst-View-Mason/t/lib/TestApp.pm
===================================================================
--- trunk/Catalyst-View-Mason/t/lib/TestApp.pm (rev 0)
+++ trunk/Catalyst-View-Mason/t/lib/TestApp.pm 2007-08-28 15:58:00 UTC (rev 6746)
@@ -0,0 +1,33 @@
+package TestApp;
+
+use strict;
+use warnings;
+use Catalyst;
+
+our $VERSION = '0.01';
+
+__PACKAGE__->config(
+ name => 'TestApp',
+ default_view => 'Pkgconfig',
+ default_message => 'hi',
+);
+
+__PACKAGE__->setup;
+
+sub test : Local {
+ my ($self, $c) = @_;
+
+ $c->stash->{message} = ($c->request->param('message') || $c->config->{default_message});
+}
+
+sub end : Private {
+ my ($self, $c) = @_;
+
+ return 1 if $c->response->status =~ /^3\d\d$/;
+ return 1 if $c->response->body;
+
+ my $view = 'Mason::' . ($c->request->param('view') || $c->config->{default_view});
+ $c->forward( $c->view($view) );
+}
+
+1;
Added: trunk/Catalyst-View-Mason/t/pkgconfig.t
===================================================================
--- trunk/Catalyst-View-Mason/t/pkgconfig.t (rev 0)
+++ trunk/Catalyst-View-Mason/t/pkgconfig.t 2007-08-28 15:58:00 UTC (rev 6746)
@@ -0,0 +1,15 @@
+#!perl
+
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use_ok('Catalyst::Test', 'TestApp');
+
+my $response = request('/test');
+
+ok($response->is_success, 'request ok');
+is($response->content, TestApp->config->{default_message}, 'message ok');
More information about the Catalyst-commits
mailing list