Commit | Line | Data |
4805c465 |
1 | use strict; |
2 | use warnings; |
6dca83ef |
3 | use FindBin qw/$Bin/; |
4805c465 |
4 | use Test::More qw/no_plan/; |
5 | |
6 | BEGIN { use_ok 'Gitalist::Model::Git' } |
7 | |
6dca83ef |
8 | my $c = bless {}, 'Gitalist'; |
9 | my $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 |
12 | use Path::Class; |
13 | my $repoBare = Path::Class::Dir->new('t/lib/repositories/bare.git'); |
14 | ok( $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 |
17 | my $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 |
21 | my $repoEmpty = Path::Class::Dir->new('t/lib/repositories/empty.git'); |
22 | ok( ! $Git->is_git_repo( $repoEmpty ), 'is_git_repo is false for empty dir' ); |
23 | |
4805c465 |
24 | my $projectList = $Git->list_projects; |
0e2b6322 |
25 | ok( scalar @{$projectList} == 1, 'list_projects returns an array with the correct number of members' ); |
4805c465 |
26 | ok( $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 | |
29 | use Data::Dumper; |
6dca83ef |
30 | #warn( Dumper($projectList) ); |
4805c465 |
31 | |