[Catalyst-commits] r6794 - trunk/Catalyst-View-Mason/t
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Tue Aug 28 17:03:14 GMT 2007
Author: rafl
Date: 2007-08-28 17:03:13 +0100 (Tue, 28 Aug 2007)
New Revision: 6794
Added:
trunk/Catalyst-View-Mason/t/helper.t
Log:
Test Catalyst::Helper::View::Mason.
Added: trunk/Catalyst-View-Mason/t/helper.t
===================================================================
--- trunk/Catalyst-View-Mason/t/helper.t (rev 0)
+++ trunk/Catalyst-View-Mason/t/helper.t 2007-08-28 16:03:13 UTC (rev 6794)
@@ -0,0 +1,47 @@
+#!perl
+
+use strict;
+use warnings;
+use Cwd;
+use File::Path;
+use Catalyst::Helper;
+use File::Spec::Functions qw/catdir catfile/;
+use Test::More;
+
+eval 'use Test::File';
+plan skip_all => 'Test::File required' if $@;
+
+eval 'use Test::Exception';
+plan skip_all => 'Test::Exception required' if $@;
+
+plan tests => 3;
+
+my $app_name = 'TestApp';
+my $old_cwd = cwd;
+my $test_dir = catdir(qw/t var/);
+
+if (!-d $test_dir) {
+ mkdir $test_dir or BAIL_OUT("Failed to create test directory: $!");
+}
+chdir $test_dir;
+
+my $helper = Catalyst::Helper->new;
+
+$helper->mk_app($app_name);
+$FindBin::Bin = catdir($app_name, 'lib');
+
+$helper->mk_component($app_name, 'view', 'Mason', 'Mason');
+
+my $module = catfile($app_name, 'lib', $app_name, 'View', 'Mason.pm');
+file_exists_ok($module, 'module created');
+
+lives_ok(sub {
+ do $module;
+}, 'module compiles fine');
+
+ok(!TestApp::View::Mason->config->{use_match}, 'module sets use_match to false');
+
+END {
+ chdir $old_cwd;
+ rmtree($test_dir);
+}
More information about the Catalyst-commits
mailing list