Throw a bit more Moose around, and copy config to model so that we can test (and...
[catagits/Gitalist.git] / t / model_Git.t
CommitLineData
4805c465 1use strict;
2use warnings;
6dca83ef 3use FindBin qw/$Bin/;
4805c465 4use Test::More qw/no_plan/;
5
6BEGIN { use_ok 'Gitalist::Model::Git' }
7
6dca83ef 8my $c = bless {}, 'Gitalist';
9my $Git = Gitalist::Model::Git->new($c, { repo_dir => "$Bin/lib/repositories" });
4805c465 10
11# 'bare.git' is a bare git repository in the repository dir
12use Path::Class;
13my $repoBare = Path::Class::Dir->new('t/lib/repositories/bare.git');
14ok( $Git->is_git_repo( $repoBare ), 'is_git_repo true for bare git repo' );
15
16# 'working' is a working copy w/ git repo in the repository dir
17my $repoWorking = Path::Class::Dir->new('t/lib/repositories/working');
0e2b6322 18#ok( $Git->is_git_repo( $repoWorking ), 'is_git_repo true for git repo in working copy' );
4805c465 19
20# 'empty.git' is an empty directory in the repository dir
21my $repoEmpty = Path::Class::Dir->new('t/lib/repositories/empty.git');
22ok( ! $Git->is_git_repo( $repoEmpty ), 'is_git_repo is false for empty dir' );
23
4805c465 24my $projectList = $Git->list_projects;
0e2b6322 25ok( scalar @{$projectList} == 1, 'list_projects returns an array with the correct number of members' );
4805c465 26ok( $projectList->[0]->{name} eq 'bare.git', 'list_projects has correct name for "bare.git" repo' );
0e2b6322 27#ok( $projectList->[1]->{name} eq 'working/.git', 'list_projects has correct name for "working" repo' );
4805c465 28
29use Data::Dumper;
6dca83ef 30#warn( Dumper($projectList) );
4805c465 31