update tests to ignore CATALYST_HOME env var
[catagits/Catalyst-Runtime.git] / t / aggregate / unit_core_path_to.t
CommitLineData
01033d73 1use strict;
2use warnings;
3
5b19d407 4use Test::More;
0891873b 5use FindBin;
6use Path::Class;
7use File::Basename;
01033d73 8
9my %non_unix = (
10 MacOS => 1,
11 MSWin32 => 1,
12 os2 => 1,
13 VMS => 1,
14 epoc => 1,
15 NetWare => 1,
16 dos => 1,
17 cygwin => 1
18);
19
20my $os = $non_unix{$^O} ? $^O : 'Unix';
21
0891873b 22if ( $os ne 'Unix' ) {
c7ded7aa 23 plan skip_all => 'tests require Unix';
5b19d407 24}
01033d73 25
01033d73 26use_ok('Catalyst');
27
fa32ac82 28my $context = 'Catalyst';
29
2e4a8275 30delete $ENV{CATALYST_HOME}; # otherwise it'll set itself up to the wrong place
31
0891873b 32$context->setup_home;
33my $base = dir($FindBin::Bin)->relative->stringify;
34
35isa_ok( Catalyst::path_to( $context, $base ), 'Path::Class::Dir' );
36isa_ok( Catalyst::path_to( $context, $base, basename $0 ), 'Path::Class::File' );
37
fa32ac82 38my $config = Catalyst->config;
39
40$config->{home} = '/home/sri/my-app/';
01033d73 41
42is( Catalyst::path_to( $context, 'foo' ), '/home/sri/my-app/foo', 'Unix path' );
43
fa32ac82 44$config->{home} = '/Users/sri/myapp/';
01033d73 45
46is( Catalyst::path_to( $context, 'foo', 'bar' ),
47 '/Users/sri/myapp/foo/bar', 'deep Unix path' );
0891873b 48
49done_testing;