avoid MSWin32 test failures
[gitmo/MooseX-Getopt.git] / t / 112_configfile_constructor_arg.t
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 use Path::Class;    # exports file, dir
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
23 {
24     my $configfile = file(qw(t 112_configfile_constructor_arg.yml))->stringify;
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