test for warnings everywhere
[gitmo/MooseX-Getopt.git] / t / 112_configfile_constructor_arg.t
CommitLineData
1c9973b6 1use strict;
2use warnings;
3
4use Test::Requires
5 'MooseX::SimpleConfig'; # skip all if not installed
6
7# respect the configfile value passed into the constructor.
8
9fbb5be9 9use Test::More tests => 3;
10use Test::NoWarnings 1.04 ':early';
395546ae 11use Path::Class; # exports file, dir
1c9973b6 12
13{
14 package Foo;
15 use Moose;
16 with 'MooseX::Getopt', 'MooseX::SimpleConfig';
17
18 has foo => (
19 is => 'ro', isa => 'Str',
20 default => 'foo default',
21 );
22}
23
1c9973b6 24{
395546ae 25 my $configfile = file(qw(t 112_configfile_constructor_arg.yml))->stringify;
1c9973b6 26
27 my $obj = Foo->new_with_options(configfile => $configfile);
28
29 is(
30 $obj->configfile,
31 $configfile,
32 'configfile value is used from the constructor',
33 );
34 is(
35 $obj->foo,
36 'foo value',
37 'value is read in from the config file',
38 );
39}
40