docs
[catagits/Catalyst-Runtime.git] / t / aggregate / unit_core_path_to.t
index a89135c..b93faa8 100644 (file)
@@ -2,6 +2,14 @@ use strict;
 use warnings;
 
 use Test::More;
+use FindBin;
+use Path::Class;
+use File::Basename;
+BEGIN {
+    delete $ENV{CATALYST_HOME}; # otherwise it'll set itself up to the wrong place
+}
+use lib "$FindBin::Bin/../lib";
+use TestApp;
 
 my %non_unix = (
     MacOS   => 1,
@@ -16,24 +24,22 @@ my %non_unix = (
 
 my $os = $non_unix{$^O} ? $^O : 'Unix';
 
-if(  $os ne 'Unix' ) {
+if ( $os ne 'Unix' ) {
     plan skip_all => 'tests require Unix';
 }
-else {
-    plan tests => 3;
-}
 
 use_ok('Catalyst');
 
-my $context = 'Catalyst';
-
-my $config = Catalyst->config;
+my $context = 'TestApp';
+my $base;
 
-$config->{home} = '/home/sri/my-app/';
+isa_ok( $base = Catalyst::path_to( $context, '' ), 'Path::Class::Dir' );
 
-is( Catalyst::path_to( $context, 'foo' ), '/home/sri/my-app/foo', 'Unix path' );
+my $config = Catalyst->config;
 
-$config->{home} = '/Users/sri/myapp/';
+is( Catalyst::path_to( $context, 'foo' ), "$base/foo", 'Unix path' );
 
 is( Catalyst::path_to( $context, 'foo', 'bar' ),
-    '/Users/sri/myapp/foo/bar', 'deep Unix path' );
+    "$base/foo/bar", 'deep Unix path' );
+
+done_testing;