Skip to content

Commit

Permalink
distribution: support rt and github methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mickeyn committed Dec 8, 2016
1 parent 6791362 commit 44d6da7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
13 changes: 13 additions & 0 deletions lib/MetaCPAN/Client/Distribution.pm
Expand Up @@ -39,6 +39,9 @@ foreach my $field ( @known_fields ) {

sub _known_fields { return \%known_fields }

sub rt { $_[0]->bugs->{rt} || {} }
sub github { $_[0]->bugs->{github} || {} }

1;

__END__
Expand All @@ -62,3 +65,13 @@ Hash-Ref.
=head2 river
Hash-Ref.
=head1 METHODS
=head2 rt
Returns 'bugs.rt' hash ref (defaults to {}).
=head2 github
Returns 'bugs.github' hash ref (defaults to {}).
13 changes: 10 additions & 3 deletions t/api/distribution.t
Expand Up @@ -2,15 +2,22 @@

use strict;
use warnings;
use Test::More tests => 5;
use Test::More tests => 9;
use Test::Fatal;
use Ref::Util qw< is_hashref >;

use t::lib::Functions;

my $mc = mcpan();
can_ok( $mc, 'distribution' );

my $dist = $mc->distribution('Moose');
my $dist = $mc->distribution('Business-ISBN');
isa_ok( $dist, 'MetaCPAN::Client::Distribution' );
can_ok( $dist, 'name' );
is( $dist->name, 'Moose', 'Correct distribution' );
is( $dist->name, 'Business-ISBN', 'Correct distribution' );

can_ok( $dist, 'rt' );
ok( is_hashref( $dist->rt ), 'rt returns a hashref' );

can_ok( $dist, 'github' );
ok( is_hashref( $dist->github ), 'github returns a hashref' );

0 comments on commit 44d6da7

Please sign in to comment.