[Catalyst-commits] r6814 - in trunk/Catalyst-View-Mason:
lib/Catalyst/View t t/lib/TestApp/View/Mason
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Tue Aug 28 17:04:26 GMT 2007
Author: rafl
Date: 2007-08-28 17:04:25 +0100 (Tue, 28 Aug 2007)
New Revision: 6814
Added:
trunk/Catalyst-View-Mason/t/stringify.t
Modified:
trunk/Catalyst-View-Mason/lib/Catalyst/View/Mason.pm
trunk/Catalyst-View-Mason/t/lib/TestApp/View/Mason/Pkgconfig.pm
Log:
Properly stringify comp_root and data_dir and test it.
Modified: trunk/Catalyst-View-Mason/lib/Catalyst/View/Mason.pm
===================================================================
--- trunk/Catalyst-View-Mason/lib/Catalyst/View/Mason.pm 2007-08-28 16:04:19 UTC (rev 6813)
+++ trunk/Catalyst-View-Mason/lib/Catalyst/View/Mason.pm 2007-08-28 16:04:25 UTC (rev 6814)
@@ -73,7 +73,7 @@
my ($self, $c, $arguments) = @_;
my %config = (
- comp_root => $c->config->{root} . q//, # stringify
+ comp_root => $c->config->{root},
data_dir => File::Spec->tmpdir,
use_match => 1,
allow_globals => [],
@@ -82,6 +82,10 @@
%{ $arguments },
);
+ # stringify comp_root and data_dir
+ $config{comp_root} .= q//;
+ $config{data_dir} .= q//;
+
unshift @{ $config{allow_globals} }, qw/$c $base $name/;
$self = $self->NEXT::new($c, \%config);
$self->{output} = q//;
Modified: trunk/Catalyst-View-Mason/t/lib/TestApp/View/Mason/Pkgconfig.pm
===================================================================
--- trunk/Catalyst-View-Mason/t/lib/TestApp/View/Mason/Pkgconfig.pm 2007-08-28 16:04:19 UTC (rev 6813)
+++ trunk/Catalyst-View-Mason/t/lib/TestApp/View/Mason/Pkgconfig.pm 2007-08-28 16:04:25 UTC (rev 6814)
@@ -8,4 +8,11 @@
allow_globals => [qw/$foo @bar/],
);
+if ($::use_path_class) {
+ __PACKAGE__->config(
+ comp_root => TestApp->path_to('root'),
+ data_dir => TestApp->path_to('root', 'var'),
+ );
+}
+
1;
Added: trunk/Catalyst-View-Mason/t/stringify.t
===================================================================
--- trunk/Catalyst-View-Mason/t/stringify.t (rev 0)
+++ trunk/Catalyst-View-Mason/t/stringify.t 2007-08-28 16:04:25 UTC (rev 6814)
@@ -0,0 +1,22 @@
+#!perl
+
+use strict;
+use warnings;
+use Test::More tests => 4;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+{
+ no warnings 'once';
+ $::use_path_class = 1;
+}
+
+use_ok('Catalyst::Test', 'TestApp');
+
+ok(!ref TestApp::View::Mason::Pkgconfig->config->{comp_root}, 'comp_root got stringified');
+ok(!ref TestApp::View::Mason::Pkgconfig->config->{data_dir}, 'data_dir got stringified');
+
+my $response = request('/test?view=Pkgconfig');
+
+ok($response->is_success, 'request ok');
More information about the Catalyst-commits
mailing list