summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build.PL35
-rw-r--r--t/003_hook_route.t10
-rw-r--r--t/008_git_clone.t55
-rw-r--r--t/data/hook_data.yml3
4 files changed, 80 insertions, 23 deletions
diff --git a/Build.PL b/Build.PL
index ad985f4..a1b2814 100644
--- a/Build.PL
+++ b/Build.PL
@@ -15,22 +15,25 @@ my $builder = Module::Build->new(
'Test::MockObject'=> 0,
},
requires => {
- 'YAML' => 0,
- 'Dancer' => 1.1810,
- 'XML::Feed' => 0,
- 'DateTime' => 0,
- 'JSON' => 0,
- 'YAML' => 0,
- 'Dancer::Template::Xslate' => 0,
- 'Dancer::Plugin::DBIC' => 0,
- 'DBIx::Class' => 0,
- 'DateTime::Format::SQLite' => 0,
- 'SQL::Translator' => 0,
- 'Digest::MD5' => 0,
- 'App::perlbrew' => 0,
- 'Dist::Zilla' => 0,
- 'Email::Stuff' => 0,
- 'Time::Elapsed' => 0,
+ 'autodie' => 0,
+ 'IPC::System::Simple' => 0,
+ 'IPC::Cmd' => 0,
+ 'YAML' => 0,
+ 'Dancer' => 1.1810,
+ 'XML::Feed' => 0,
+ 'DateTime' => 0,
+ 'JSON' => 0,
+ 'YAML' => 0,
+ 'Dancer::Template::Xslate' => 0,
+ 'Dancer::Plugin::DBIC' => 0,
+ 'DBIx::Class' => 0,
+ 'DateTime::Format::SQLite' => 0,
+ 'SQL::Translator' => 0,
+ 'Digest::MD5' => 0,
+ 'App::perlbrew' => 0,
+ 'Dist::Zilla' => 0,
+ 'Email::Stuff' => 0,
+ 'Time::Elapsed' => 0,
'DBIx::Class::DeploymentHandler' => 0,
},
add_to_cleanup => [ 'jitterbug-', catfile(qw/t data jitterbug.db/) ],
diff --git a/t/003_hook_route.t b/t/003_hook_route.t
index 0361b15..6e86dfd 100644
--- a/t/003_hook_route.t
+++ b/t/003_hook_route.t
@@ -44,7 +44,7 @@ my $response;
}
{
- my $rs = $schema->resultset('Project')->find( { name => 'Dancer' } );
+ my $rs = $schema->resultset('Project')->find( { name => 'testing' } );
ok !defined $rs, 'no project dancer yet';
$response = dancer_response(
@@ -58,11 +58,11 @@ my $response;
is $response->{status}, 200, 'status OK with payload';
is_deeply JSON::decode_json( $response->{content} ),
- { updated => 'Dancer' }, 'response OK with payload';
+ { updated => 'testing' }, 'response OK with payload';
- $rs = $schema->resultset('Project')->find( { name => 'Dancer' } );
+ $rs = $schema->resultset('Project')->find( { name => 'testing' } );
ok $rs, 'project exists in DB';
- is $rs->name, 'Dancer', 'project\'s name is good';
+ is $rs->name, 'testing', 'project\'s name is good';
is $schema->resultset('Task')->search()->count(), 1, 'one task created';
}
@@ -90,7 +90,7 @@ my $response;
$schema->resultset('Task')->search()->delete();
# testing with invalid global branch
- setting jitterbug => { branches => { Dancer => ['foo'], }, };
+ setting jitterbug => { branches => { testing => ['foo'], }, };
$content->{ref} = 'refs/heads/foo';
$response = dancer_response(
POST => '/hook/',
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;
+}
diff --git a/t/data/hook_data.yml b/t/data/hook_data.yml
index 401f6c4..a55d7e9 100644
--- a/t/data/hook_data.yml
+++ b/t/data/hook_data.yml
@@ -8,8 +8,7 @@ commits:
author:
email: franck@lumberjaph.net
name: franck cuny
- #id: 8c3c1d6be0fa27ada4f03258ddea7683c967a925
- id: ba54d9b7d82eabe4ba35ec212eb24d00869119d5
+ id: 3ab75b9a29e09bf027f64250b44cab19b316c128
message: test
modified:
- lib/Dancer.pm