summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--lib/jitterbug/Builder.pm2
-rw-r--r--t/005_builder.t23
2 files changed, 20 insertions, 5 deletions
diff --git a/lib/jitterbug/Builder.pm b/lib/jitterbug/Builder.pm
index 0cd3d6b..6bb5ba3 100644
--- a/lib/jitterbug/Builder.pm
+++ b/lib/jitterbug/Builder.pm
@@ -28,6 +28,8 @@ sub new {
     $self->{'configfile'}
         or die qq{missing config.yml, use "-c config.yml" to help us find it\n};
 
+    die "Does not exist!: " . $self->{'configfile'} unless -e $self->{'configfile'};
+
     return $self;
 }
 
diff --git a/t/005_builder.t b/t/005_builder.t
index 685ad57..15795d6 100644
--- a/t/005_builder.t
+++ b/t/005_builder.t
@@ -1,31 +1,44 @@
 
 use strict;
 use warnings;
-use Test::Most tests => 6;
+use Test::Most tests => 7;
+use Data::Dumper;
 
 use jitterbug::Builder;
 
 {
-    local @ARGV = qw(-c foo.yml -C);
+    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'}, 'foo.yml');
+    is($b->{'configfile'}, 't/data/test.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');
+    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
+    });
+
 
 }
+