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 | |
22 | TODO: |
23 | { |
24 | local $TODO = "doh, this doesn't work!"; |
25 | |
26 | my $configfile = 't/112_configfile_constructor_arg.yml'; |
27 | |
28 | my $obj = Foo->new_with_options(configfile => $configfile); |
29 | |
30 | is( |
31 | $obj->configfile, |
32 | $configfile, |
33 | 'configfile value is used from the constructor', |
34 | ); |
35 | is( |
36 | $obj->foo, |
37 | 'foo value', |
38 | 'value is read in from the config file', |
39 | ); |
40 | } |
41 | |