diff options
author | Jonathan "Duke" Leto <jonathan@leto.net> | 2011-05-22 22:17:29 -0700 |
---|---|---|
committer | Jonathan "Duke" Leto <jonathan@leto.net> | 2011-05-22 22:17:29 -0700 |
commit | 4b36d82c173ce6cb24f52a9e30dc08354c0af2e3 (patch) | |
tree | 98f888830595abd1f9e2a411d4c151ec35beb0af /t/008_git_clone.t | |
parent | Try adding a git repo for testing again (diff) | |
download | jitterbug-4b36d82c173ce6cb24f52a9e30dc08354c0af2e3.tar.gz |
Add a test file for git cloning
Diffstat (limited to 't/008_git_clone.t')
-rw-r--r-- | t/008_git_clone.t | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/t/008_git_clone.t b/t/008_git_clone.t new file mode 100644 index 0000000..c4935ce --- /dev/null +++ b/t/008_git_clone.t @@ -0,0 +1,55 @@ +use Test::More tests => 3; +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/; +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] + } + } +}; + +if (can_run('git')){ + + my $gitrepo = "t/data/testing"; + dircopy "$gitrepo/._git_", "$gitrepo/.git" unless -e "$gitrepo/.git"; + + lives_ok sub { system("$^X scripts/post_to_hook.pl") }, 'post_to_hook.pl lives'; + + lives_ok sub { system("$^X scripts/builder.pl -c t/data/test.yml -C") }, 'builder.pl lives'; + + ok(-e "t/tmp/build/testing/.git", 'found a testing git repo'); +} else { + skip "Git not available, skipping tests", 3; +} |