Commit | Line | Data |
1c9973b6 |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use Test::Requires |
5 | 'MooseX::SimpleConfig'; # skip all if not installed |
6 | |
7 | # respect the configfile value passed into the constructor. |
8 | |
9 | use Test::More tests => 2; |
10 | |
11 | { |
12 | package Foo; |
13 | use Moose; |
14 | with 'MooseX::Getopt', 'MooseX::SimpleConfig'; |
15 | |
16 | has foo => ( |
17 | is => 'ro', isa => 'Str', |
18 | default => 'foo default', |
19 | ); |
20 | } |
21 | |
1c9973b6 |
22 | { |
1c9973b6 |
23 | my $configfile = 't/112_configfile_constructor_arg.yml'; |
24 | |
25 | my $obj = Foo->new_with_options(configfile => $configfile); |
26 | |
27 | is( |
28 | $obj->configfile, |
29 | $configfile, |
30 | 'configfile value is used from the constructor', |
31 | ); |
32 | is( |
33 | $obj->foo, |
34 | 'foo value', |
35 | 'value is read in from the config file', |
36 | ); |
37 | } |
38 | |