add test counts, obviating done_testing
[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
9use Test::More tests => 2;
395546ae 10use Path::Class; # exports file, dir
1c9973b6 11
12{
13 package Foo;
14 use Moose;
15 with 'MooseX::Getopt', 'MooseX::SimpleConfig';
16
17 has foo => (
18 is => 'ro', isa => 'Str',
19 default => 'foo default',
20 );
21}
22
1c9973b6 23{
395546ae 24 my $configfile = file(qw(t 112_configfile_constructor_arg.yml))->stringify;
1c9973b6 25
26 my $obj = Foo->new_with_options(configfile => $configfile);
27
28 is(
29 $obj->configfile,
30 $configfile,
31 'configfile value is used from the constructor',
32 );
33 is(
34 $obj->foo,
35 'foo value',
36 'value is read in from the config file',
37 );
38}
39