do not load MooseX::SimpleConfig unconditionally
[gitmo/MooseX-ConfigFromFile.git] / t / 06_path_tiny.t
1 use strict;
2 use warnings;
3
4 use Test::Requires 'MooseX::SimpleConfig';      # skip all if not reuqired
5 use Test::More tests => 5;
6 use Test::NoWarnings 1.04 ':early';
7 use Path::Tiny 'path';
8 use Path::Class 'file';
9
10 {
11     package Generic;
12     use Moose;
13     with 'MooseX::SimpleConfig';
14     sub get_config_from_file { }
15 }
16
17 {
18     my $obj = Generic->new(configfile => path('i/do/not_exist'));
19     is($obj->configfile, 'i/do/not_exist', 'stringification returns path');
20     isa_ok($obj->configfile, 'Path::Tiny');
21 }
22
23 {
24     my $obj = Generic->new(configfile => file('i/do/not_exist'));
25     is($obj->configfile, 'i/do/not_exist', 'stringification returns path');
26     isa_ok($obj->configfile, 'Path::Tiny');
27 }
28