summary refs log tree commit diff
path: root/t/builder.t
blob: 685ad571d6d56b456855c1a6920c332d67b0b9f2 (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
use strict;
use warnings;
use Test::Most tests => 6;

use jitterbug::Builder;

{
    local @ARGV = qw(-c foo.yml -C);
    my $b = jitterbug::Builder->new();

    isa_ok($b,'jitterbug::Builder');
    can_ok($b,qw/run build run_task sleep/);

    is($b->{'configfile'}, 'foo.yml');
    is($b->{'cron'}, 1 );
}

{
    local @ARGV = qw(-c blarg.yml -C);
    my $b = jitterbug::Builder->new();

    throws_ok (sub {$b->run}, qr/YAML Error/i, 'nonexistent yaml file throws error');
}

{
    local @ARGV = qw(-c t/data/test.yml -C);
    my $b = jitterbug::Builder->new();
    is($b->run, 0, '->run returns 0 in cron mode');

}