X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Faggregate%2Funit_core_path_to.t;h=b93faa854250ce03508915df5b16364cc00a53ed;hb=cd61f3ab24b7dcc59068c35d62ddb4bb9b9162c8;hp=a89135c578fca0b2e1c46f9645488e3dbf3ee87a;hpb=5d50f369bffa3625ca983b72fc8bc013c8a1e802;p=catagits%2FCatalyst-Runtime.git diff --git a/t/aggregate/unit_core_path_to.t b/t/aggregate/unit_core_path_to.t index a89135c..b93faa8 100644 --- a/t/aggregate/unit_core_path_to.t +++ b/t/aggregate/unit_core_path_to.t @@ -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;