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,
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;