Added path_to method
[catagits/Catalyst-Runtime.git] / t / unit / core / path_to.t
1 use strict;
2 use warnings;
3
4 use Test::More tests => 3;
5 use Test::MockObject;
6
7 my %non_unix = (
8     MacOS   => 1,
9     MSWin32 => 1,
10     os2     => 1,
11     VMS     => 1,
12     epoc    => 1,
13     NetWare => 1,
14     dos     => 1,
15     cygwin  => 1
16 );
17
18 my $os = $non_unix{$^O} ? $^O : 'Unix';
19
20 plan skip_all => 'tests require Unix' unless $os eq 'Unix';
21
22 my $context = Test::MockObject->new;
23
24 use_ok('Catalyst');
25
26 $context->mock( 'config', sub { { home => '/home/sri/my-app/' } } );
27
28 is( Catalyst::path_to( $context, 'foo' ), '/home/sri/my-app/foo', 'Unix path' );
29
30 $context->mock( 'config', sub { { home => '/Users/sri/myapp' } } );
31
32 is( Catalyst::path_to( $context, 'foo', 'bar' ),
33     '/Users/sri/myapp/foo/bar', 'deep Unix path' );