Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,11 @@ requires "warnings" => "0";

on 'test' => sub {
requires "Carp" => "0";
requires "DDP" => "0";
requires "ExtUtils::MakeMaker" => "0";
requires "File::Spec" => "0";
requires "IO::Handle" => "0";
requires "IPC::Open3" => "0";
requires "Test2::V1" => "0";
requires "Test::MockObject" => "0";
requires "Test::More" => "0";
};

Expand Down
70 changes: 41 additions & 29 deletions t/clone.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use Test2::V1 -Pip;
use Git::CPAN::Patch::Command::Clone;
use File::Temp qw/ tempdir /;
use Git::Repository 'AUTOLOAD';
use Test::MockObject;

my $data = {
name => 'Git-CPAN-Patch',
Expand All @@ -16,37 +15,50 @@ my $data = {
version => '0.4.4',
};

my $metacpan = Test::MockObject->new
->set_false( 'module' )
->mock( 'release', sub {
return Test::MockObject->new->set_always( data => $data )
my $metacpan = mock {} => (
add => [
module => sub { 0 },
release => sub {
return mock { data => $data }
if $_[1] eq 'Git-CPAN-Patch';

return Test::MockObject->new->set_series( next =>
Test::MockObject->new->set_always( data => {
'status' => 'cpan',
'distribution' => 'Git-CPAN-Patch',
author => 'YANICK',
date => '2011-03-06T01:02:03',
download_url => './t/corpus/Git-CPAN-Patch-0.4.5.tar.gz',
version => '0.4.4',
metadata => {
'author' => [
'Yanick Champoux <yanick@cpan.org>'
],
if (ref $_[1]) {
my @releases = (
mock {
data => {
'status' => 'cpan',
'distribution' => 'Git-CPAN-Patch',
author => 'YANICK',
date => '2011-03-06T01:02:03',
download_url => './t/corpus/Git-CPAN-Patch-0.4.5.tar.gz',
version => '0.4.4',
metadata => {
'author' => [
'Yanick Champoux <yanick@cpan.org>'
],
},
},
meta => {
'author' => [
'Yanick Champoux <yanick@cpan.org>'
],
},
},
})->set_always( meta => {
'author' => [
'Yanick Champoux <yanick@cpan.org>'
], })
) if ref $_[1];

use Carp;
use DDP;
warn p $_[1];
confess;
}
);
);
return mock {} => (
add => [
next => sub {
return shift @releases;
},
],
);
}

require Carp;
Carp::confess "Unhandled release: $_[1]";
},
],
);

subtest $_ => sub { test_clone($_) } for
qw[ Git-CPAN-Patch ./t/corpus/Git-CPAN-Patch-0.4.5.tar.gz ];
Expand Down