Added test for Git::Wrapper
[p5sagit/Oyster.git] / t / Deploy / git.t
1 #!/usr/local/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More qw/no_plan/;
7 use Test::Exception;
8
9 use File::Temp qw/tempdir/;
10
11 BEGIN { use_ok( 'Oyster::Deploy::Git' ); }
12 BEGIN { use_ok( 'Git::Wrapper' ); }
13
14 my $tmpdir = tempdir();
15
16 my $deploy = new_ok 'Oyster::Deploy::Git';
17
18 #create
19 is($deploy->create("${tmpdir}/testapp"), 1, 'Create returned okay');
20
21 ok((-d "${tmpdir}/testapp"), "App directory created");
22
23 throws_ok(sub {$deploy->create("${tmpdir}/testapp")}, 'Error::Simple', "Directory already exists");
24 ok((-f "${tmpdir}/testapp/.git/hooks/post-receive"), "Post reveive hook exists");
25 ok((-f "${tmpdir}/testapp/.git/hooks/post-update"), "Post update hook exists");