App-GitGot
view release on metacpan or search on metacpan
t/lib/Test/App/GitGot/Repo.pm view on Meta::CPAN
package Test::App::GitGot::Repo;
use parent 'Test::BASE';
use 5.014; # strict, unicode_strings
use warnings;
use App::GitGot::Repo;
use File::Temp qw/ tempdir /;
use Path::Tiny;
use Test::Exception;
use Test::More;
sub fixtures :Test(startup) {
my $test = shift;
$test->{lib} = 'App::GitGot::Repo';
$test->make_base_fixtures;
}
sub test_constructor :Test(3) {
my $test = shift;
my $lib = $test->{lib};
my $entry = $test->{entry};
new_ok( $lib , [{ entry => $entry }] );
dies_ok { $lib->new({}) } 'has req args' ;
like( $@ , qr/Must provide entry/ , 'expected error message' );
}
sub test_accessors :Tests(8) {
my $test = shift;
my $full = $test->{full};
my $min = $test->{min};
# only test the ones that get munged in BUILDALL...
is( $full->name , 'my-full-repo' , 'full name' );
is( $min->name , 'my-repo' , 'min name' );
is( $full->number , 1 , 'full number' );
is( $min->number , 0 , 'min number' );
is( $full->repo , 'git@github:/luser/my-full-repo.git' , 'full repo' );
is( $min->repo , '' , 'min repo' );
is( $full->tags , 'tag1,tag2' , 'full tags' );
is( $min->tags , '' , 'min tags' );
}
sub test_in_writable_format :Tests(2) {
my $test = shift;
{
my $entry = {
name => 'my-repo' ,
path => $test->{minpath} ,
type => 'git' ,
};
my $min = $test->{min};
( run in 2.116 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )