From: Tomas Doran Date: Mon, 6 Feb 2012 22:17:30 +0000 (+0000) Subject: Change path_to testing to use a real app to test it really works X-Git-Tag: 5.90009~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=78da9e75dbdaaebbda2f57bd4fae884224fc5a47 Change path_to testing to use a real app to test it really works --- diff --git a/t/aggregate/unit_core_path_to.t b/t/aggregate/unit_core_path_to.t index 823e626..b93faa8 100644 --- a/t/aggregate/unit_core_path_to.t +++ b/t/aggregate/unit_core_path_to.t @@ -5,6 +5,11 @@ 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, @@ -25,25 +30,16 @@ if ( $os ne 'Unix' ) { use_ok('Catalyst'); -my $context = 'Catalyst'; - -delete $ENV{CATALYST_HOME}; # otherwise it'll set itself up to the wrong place - -$context->setup_home; -my $base = dir($FindBin::Bin)->relative->stringify; +my $context = 'TestApp'; +my $base; -isa_ok( Catalyst::path_to( $context, $base ), 'Path::Class::Dir' ); -isa_ok( Catalyst::path_to( $context, $base, basename $0 ), 'Path::Class::File' ); +isa_ok( $base = Catalyst::path_to( $context, '' ), 'Path::Class::Dir' ); my $config = Catalyst->config; -$config->{home} = '/home/sri/my-app/'; - -is( Catalyst::path_to( $context, 'foo' ), '/home/sri/my-app/foo', 'Unix path' ); - -$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;