blob: 15795d6a5603bca6976ef8d16c6703475b5a09bc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
use strict;
use warnings;
use Test::Most tests => 7;
use Data::Dumper;
use jitterbug::Builder;
{
local @ARGV = qw(-c t/data/test.yml -C);
my $b = jitterbug::Builder->new();
isa_ok($b,'jitterbug::Builder');
can_ok($b,qw/run build run_task sleep/);
is($b->{'configfile'}, 't/data/test.yml');
is($b->{'cron'}, 1 );
}
{
local @ARGV = qw(-c blarg.yml -C);
throws_ok (sub {
my $b = jitterbug::Builder->new();
}, qr/Does not exist/i, 'nonexistent yaml file throws error');
}
{
local @ARGV = qw(-c t/data/test.yml -C);
my $b = jitterbug::Builder->new();
isa_ok($b, 'jitterbug::Builder');
is($b->{'configfile'}, 't/data/test.yml');
#warn Dumper [ $b ];
is($b->run, 0, '->run returns 0 in cron mode');
cmp_deeply($b->{'conf'}, {
'configfile' => 't/data/test.yml',
'cron' => 1,
'sleep' => undef
});
}
|