stop using Moo as a test package
[catagits/Catalyst-Runtime.git] / t / aggregate / unit_utils_home.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5 use File::Temp qw/ tempdir /;
6 use Catalyst::Utils;
7 use File::Spec;
8 use Path::Class qw/ dir /;
9 use Cwd qw/ cwd /;
10
11 my @dists = Catalyst::Utils::dist_indicator_file_list();
12 is(scalar(@dists), 4, 'Makefile.PL Build.PL dist.ini cpanfile');
13
14 my $cwd = cwd();
15 foreach my $inc ('', 'lib', 'blib'){
16     my $d = tempdir(CLEANUP => 1);
17     chdir($d);
18     local $INC{'MyApp.pm'} = File::Spec->catfile($d, $inc, 'MyApp.pm');
19     ok !Catalyst::Utils::home('MyApp'), "No files found inc $inc";
20     open(my $fh, '>', "Makefile.PL");
21     close($fh);
22     is Catalyst::Utils::home('MyApp'), dir($d)->absolute->cleanup, "Did find inc '$inc'";
23 }
24
25 {
26     my $d = tempdir(CLEANUP => 1);
27     local $INC{'MyApp.pm'} = File::Spec->catfile($d, 'MyApp.pm');
28     ok !Catalyst::Utils::home('MyApp'), 'No files found';
29     mkdir File::Spec->catdir($d, 'MyApp');
30     is Catalyst::Utils::home('MyApp'), dir($d, 'MyApp')->absolute->cleanup;
31 }
32
33 chdir($cwd);
34
35 done_testing;
36