about summary refs log tree commit diff
path: root/t
diff options
context:
space:
mode:
authorJonathan "Duke" Leto <jonathan@leto.net>2011-01-05 12:46:34 -0800
committerJonathan "Duke" Leto <jonathan@leto.net>2011-01-05 12:46:34 -0800
commit5dcbe2d820974c300ca2e537db43a33512be4363 (patch)
treec0558c90ee21273fcc7609bc4b305341b81fb39b /t
parentImprove debug info and add some basic jitterbug::Builder tests (diff)
downloadjitterbug-5dcbe2d820974c300ca2e537db43a33512be4363.tar.gz
Add a few more simple tests
Diffstat (limited to '')
-rw-r--r--t/builder.t24
-rw-r--r--t/data/test.yml30
2 files changed, 50 insertions, 4 deletions
diff --git a/t/builder.t b/t/builder.t
index c952c12..685ad57 100644
--- a/t/builder.t
+++ b/t/builder.t
@@ -1,15 +1,31 @@
 
 use strict;
 use warnings;
-use Test::More tests => 3;
+use Test::Most tests => 6;
 
 use jitterbug::Builder;
 
 {
-    local @ARGV = qw(-c blarg.yml);
+    local @ARGV = qw(-c foo.yml -C);
     my $b = jitterbug::Builder->new();
 
     isa_ok($b,'jitterbug::Builder');
-    is($b->{'configfile'}, 'blarg.yml');
-    can_ok($b,'run');
+    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');
+
 }
diff --git a/t/data/test.yml b/t/data/test.yml
new file mode 100644
index 0000000..e4144c3
--- /dev/null
+++ b/t/data/test.yml
@@ -0,0 +1,30 @@
+layout: "main"
+logger: "file"
+appname: "jitterbug"
+
+builds_per_feed: 5
+template: "xslate"
+engines:
+  xslate:
+    path: /
+    type: text
+    cache: 0
+
+jitterbug:
+  reports:
+    dir: /tmp/jitterbug
+  build:
+    dir: /tmp/build
+  build_process:
+    builder: ./scripts/capsule.sh
+    on_failure: ./scripts/build-failed.sh
+
+plugins:
+  DBIC:
+    schema:
+      skip_automake: 1
+      pckg: "jitterbug::Schema"
+      connect_info:
+        - dbi:SQLite:dbname=jitterbug.db
+
+