Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
groom_contributors() logic has been moved to the API.
  • Loading branch information
oalders committed May 13, 2017
1 parent 258f845 commit 6a55f4c
Showing 1 changed file with 0 additions and 111 deletions.
111 changes: 0 additions & 111 deletions t/model/release-info.t
Expand Up @@ -13,117 +13,6 @@ sub release_info {
$model->new( c => $ctx, @_ );
}

sub groom_contributors {
my ( $meta, $author ) = @_;

# Author is used to de-dupe, but not actually added to contributors.
$author ||= {
pauseid => 'LOCAL',
name => 'A CPAN Author',
gravatar_url => '/gravatar/LOCAL',
email => ['local@example.com'],
};
release_info(

# release object
release => {
author => $author->{pauseid},
metadata => $meta,
},
author => $author,
)->groom_contributors;
}

subtest contributors => sub {
my $uri_prefix = 'http://localhost';
my $xy_string = 'X <y@cpan.org>';
my $xy_parsed = {
name => 'X',
email => [ 'y@cpan.org', ],
pauseid => 'Y',
url => "$uri_prefix/author/Y",
};

is_deeply(
groom_contributors(
{
x_contributors => [ 'Just A Name', 'A <b@c.d>', $xy_string, ],
}
),
[
{
name => 'Just A Name',
email => [],
},
{
name => 'A',
email => ['b@c.d'],
},
$xy_parsed,
],
'parse array of contributor strings'
);

is_deeply(
groom_contributors(
{
x_contributors => $xy_string,
}
),
[ $xy_parsed, ],
'groom single contributor string (not array)'
);

is_deeply(
groom_contributors(
{
x_contributors => [
$xy_string,
'person <local@cpan.org>', # releaser pauseid
'person <local@example.com>', # releaser email
'A CPAN Author <local@example.org>', # releaser name
'A. Nother <another@example.com>',
'Hello <again@example.com>',
],
author => [ 'Hello <there@example.com>', ],
}
),
[
{
email => [ 'there@example.com', 'again@example.com' ],
name => 'Hello',
},
$xy_parsed,
{
email => ['another@example.com'],
name => 'A. Nother',
}
],
'releaser removed from contributors by name and email'
);

is_deeply(
groom_contributors(
{
x_contributors => $xy_string,
author => 'unknown',
}
),
[ $xy_parsed, ],
'unknown author left out'
);

is_deeply(
groom_contributors(
{
x_contributors => { 'A <b@c.d>', 'X <y@cpan.org>', }
}
),
[],
'groom_contributors returns none but does not die with hashref'
);
};

my $rt_prefix = $model->rt_url_prefix;

sub bugtracker {
Expand Down

0 comments on commit 6a55f4c

Please sign in to comment.