diff options
Diffstat (limited to 't/005_builder.t')
| -rw-r--r-- | t/005_builder.t | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/t/005_builder.t b/t/005_builder.t new file mode 100644 index 0000000..84e13ef --- /dev/null +++ b/t/005_builder.t @@ -0,0 +1,76 @@ + +use strict; +use warnings; +use Test::Most tests => 9; +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'); + + is($b->run, 0, '->run returns 0 in cron mode'); + cmp_deeply($b->{'conf'}, { + 'engines' => { + 'xslate' => { + 'type' => 'text', + 'path' => '/', + 'cache' => '0' + } + }, + 'plugins' => { + 'DBIC' => { + 'schema' => { + 'connect_info' => [ + 'dbi:SQLite:dbname=jitterbug.db' + ], + 'pckg' => 'jitterbug::Schema', + 'skip_automake' => '1' + } + } + }, + 'jitterbug' => { + 'build_process' => { + 'on_failure' => './scripts/build-failed.sh', + 'builder' => './scripts/capsule.sh' + }, + 'builder' => {}, + 'reports' => { + 'dir' => '/tmp/jitterbug' + }, + 'build' => { + 'dir' => '/tmp/build' + } + }, + 'template' => 'xslate', + 'appname' => 'jitterbug', + 'layout' => 'main', + 'logger' => 'file', + 'builds_per_feed' => '5' + }); + + +} + |
