X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F02git_repo.t;h=ab35c597870272acf50d8892f0557e98be0cdd5e;hb=2819375187cb00d50556d1e16d25df6c0f9f7bb5;hp=4f5758bc93356a7afe41ac05d1c00080f2792796;hpb=3bbb120227883793d2db426dbab3f9254331a6f7;p=catagits%2FGitalist.git diff --git a/t/02git_repo.t b/t/02git_repo.t index 4f5758b..ab35c59 100644 --- a/t/02git_repo.t +++ b/t/02git_repo.t @@ -14,8 +14,22 @@ isa_ok($repo, 'Gitalist::Git::Repo'); is($repo->repo_dir, $repo_dir, "repo->repo_dir is correct" ); -my $project_list = $repo->{projects}; +# 'bare.git' is a bare git repository in the repository dir +use Path::Class; +my $repoBare = Path::Class::Dir->new('t/lib/repositories/bare.git'); +ok( $repo->_is_git_repo( $repoBare ), 'is_git_repo true for bare git repo' ); + +# 'working' is a working copy w/ git repo in the repository dir +my $repoWorking = Path::Class::Dir->new('t/lib/repositories/working'); + +# 'empty.git' is an empty directory in the repository dir +my $repoEmpty = Path::Class::Dir->new('t/lib/repositories/empty.git'); +ok( ! $repo->_is_git_repo( $repoEmpty ), 'is_git_repo is false for empty dir' ); + +my $project_list = $repo->projects; isa_ok(@$project_list[0], 'Gitalist::Git::Project'); +ok(scalar @{$project_list} == 3, 'list_projects returns an array with the correct number of members' ); +is($project_list->[0]->{name}, 'bare.git', 'list_projects has correct name for "bare.git" repo' ); dies_ok { my $project = $repo->project('NoSuchProject');