4 use Test::More qw/no_plan/;
9 BEGIN { use_ok 'Gitalist::Git::Repo' }
11 my $repo_dir = "$Bin/lib/repositories";
12 my $repo = Gitalist::Git::Repo->new( repo_dir => $repo_dir );
13 isa_ok($repo, 'Gitalist::Git::Repo');
15 is($repo->repo_dir, $repo_dir, "repo->repo_dir is correct" );
17 # 'bare.git' is a bare git repository in the repository dir
19 my $repoBare = Path::Class::Dir->new('t/lib/repositories/bare.git');
20 ok( $repo->_is_git_repo( $repoBare ), 'is_git_repo true for bare git repo' );
22 # 'working' is a working copy w/ git repo in the repository dir
23 my $repoWorking = Path::Class::Dir->new('t/lib/repositories/working');
25 # 'empty.git' is an empty directory in the repository dir
26 my $repoEmpty = Path::Class::Dir->new('t/lib/repositories/empty.git');
27 ok( ! $repo->_is_git_repo( $repoEmpty ), 'is_git_repo is false for empty dir' );
29 my $project_list = $repo->projects;
30 isa_ok(@$project_list[0], 'Gitalist::Git::Project');
31 ok(scalar @{$project_list} == 3, 'list_projects returns an array with the correct number of members' );
32 is($project_list->[0]->{name}, 'bare.git', 'list_projects has correct name for "bare.git" repo' );
35 my $project = $repo->project('NoSuchProject');
36 } 'throws exception for invalid project';
39 my $project = $repo->project();
40 } 'throws exception for no project';
42 my $project = $repo->project('repo1');
43 isa_ok($project, 'Gitalist::Git::Project');