[Catalyst-commits] r7831 - in trunk/Catalyst-View-Mason/t: . lib
lib/TestApp/View/Mason
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Wed May 28 14:46:22 BST 2008
Author: rafl
Date: 2008-05-28 14:46:22 +0100 (Wed, 28 May 2008)
New Revision: 7831
Added:
trunk/Catalyst-View-Mason/t/extension_always.t
trunk/Catalyst-View-Mason/t/lib/TestApp/View/Mason/ExtensionAlways.pm
Modified:
trunk/Catalyst-View-Mason/t/lib/TestApp.pm
Log:
Test always_append_template_extension.
Added: trunk/Catalyst-View-Mason/t/extension_always.t
===================================================================
--- trunk/Catalyst-View-Mason/t/extension_always.t (rev 0)
+++ trunk/Catalyst-View-Mason/t/extension_always.t 2008-05-28 13:46:22 UTC (rev 7831)
@@ -0,0 +1,20 @@
+#!perl
+
+use strict;
+use warnings;
+use Test::More tests => 5;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use_ok('Catalyst::Test', 'TestApp');
+
+my $response = request('/test_set_template?view=AppConfig');
+
+ok($response->is_success, 'request ok');
+is($response->content, TestApp->config->{default_message}, 'message ok');
+
+$response = request('/test_set_template?view=ExtensionAlways');
+
+ok($response->is_success, 'request ok');
+is($response->content, 'template extension', 'used template extension');
Added: trunk/Catalyst-View-Mason/t/lib/TestApp/View/Mason/ExtensionAlways.pm
===================================================================
--- trunk/Catalyst-View-Mason/t/lib/TestApp/View/Mason/ExtensionAlways.pm (rev 0)
+++ trunk/Catalyst-View-Mason/t/lib/TestApp/View/Mason/ExtensionAlways.pm 2008-05-28 13:46:22 UTC (rev 7831)
@@ -0,0 +1,13 @@
+package TestApp::View::Mason::ExtensionAlways;
+
+use strict;
+use warnings;
+use base qw/Catalyst::View::Mason/;
+
+__PACKAGE__->config(
+ template_extension => '.mas',
+ always_append_template_extension => 1,
+ use_match => 0,
+);
+
+1;
Modified: trunk/Catalyst-View-Mason/t/lib/TestApp.pm
===================================================================
--- trunk/Catalyst-View-Mason/t/lib/TestApp.pm 2008-05-28 13:46:07 UTC (rev 7830)
+++ trunk/Catalyst-View-Mason/t/lib/TestApp.pm 2008-05-28 13:46:22 UTC (rev 7831)
@@ -37,6 +37,13 @@
$c->stash->{message} = ($c->request->param('message') || $c->config->{default_message});
}
+sub test_set_template : Local {
+ my ($self, $c) = @_;
+
+ $c->forward('test');
+ $c->stash->{template} = 'test';
+}
+
sub test_content_type : Local {
my ($self, $c) = @_;
More information about the Catalyst-commits
mailing list