blob: 6733a14559991d979474a65bbc41272963a1d2f3 (
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
use Test::More tests => 4;
use Test::Exception;
use strict;
use warnings;
use autodie qw/:all/;
use IPC::Cmd qw/can_run/;
use jitterbug;
use jitterbug::Schema;
use lib 't/lib';
use jitterbug::Test;
use JSON;
use YAML qw/LoadFile Dump/;
use File::Spec;
use File::Temp qw/tempdir/;
use Dancer::Test;
use Dancer::Config qw/setting/;
use File::Spec::Functions;
use File::Copy::Recursive qw/dircopy/;
use File::Path qw/rmtree/;
my $hook_data = catfile(qw/t data hook_data.yml/);
my $content = LoadFile($hook_data);
my $db_dir = tempdir( CLEANUP => 1 );
my $db_file = File::Spec->catfile( $db_dir, 'jitterbug.db' );
my $dsn = 'dbi:SQLite:dbname=' . $db_file;
my $schema = jitterbug::Schema->connect($dsn);
$schema->deploy;
setting plugins => {
DBIC => {
schema => {
skip_automake => 1,
pckg => "jitterbug::Schema",
connect_info => [$dsn]
}
}
};
rmtree(catfile(qw/t tmp build testing/));
if (can_run('git')){
my $gitrepo = "t/data/testing";
dircopy "$gitrepo/._git_", "$gitrepo/.git" unless -e "$gitrepo/.git";
lives_ok sub { system("$^X -Ilib scripts/post_to_hook.pl") }, 'post_to_hook.pl lives';
lives_ok sub { $ENV{DEBUG} = 1;
system("$^X -Ilib scripts/builder.pl -c t/data/test.yml -C")
}, 'builder.pl lives';
ok(-e "t/tmp/build/testing/.git", 'found a testing git repo');
chdir "t/tmp/build/testing";
chomp( my $sha1 = qx{git rev-parse HEAD} );
is($sha1,"3ab75b9a29e09bf027f64250b44cab19b316c128", "got expected sha1 in repo");
} else {
skip "Git not available, skipping tests", 3;
}
|