Add a dummy file so that the empty repo dir shows up.
[catagits/Gitalist.git] / t / model_Git.t
1 use strict;
2 use warnings;
3 use Test::More qw/no_plan/;
4
5 BEGIN { use_ok 'Gitalist::Model::Git' }
6
7 my $Git = Gitalist::Model::Git->new;
8
9 # 'bare.git' is a bare git repository in the repository dir
10 use Path::Class;
11 my $repoBare = Path::Class::Dir->new('t/lib/repositories/bare.git');
12 ok( $Git->is_git_repo( $repoBare ), 'is_git_repo true for bare git repo' );
13
14 # 'working' is a working copy w/ git repo in the repository dir
15 my $repoWorking = Path::Class::Dir->new('t/lib/repositories/working');
16 ok( $Git->is_git_repo( $repoWorking ), 'is_git_repo true for git repo in working copy' );
17
18 # 'empty.git' is an empty directory in the repository dir
19 my $repoEmpty = Path::Class::Dir->new('t/lib/repositories/empty.git');
20 ok( ! $Git->is_git_repo( $repoEmpty ), 'is_git_repo is false for empty dir' );
21
22 # At present, these tests only work if the APP_TEST env var is set.
23 # This is needed to load the test configuration.
24 diag("*** SKIPPING app tests.
25 *** Set APP_TEST for the tests to run fully") if !$ENV{APP_TEST};
26 SKIP: {
27   skip "Set APP_TEST for the tests to run fully",
28     3 if !$ENV{APP_TEST};
29
30 my $projectList = $Git->list_projects;
31 ok( scalar @{$projectList} == 2, 'list_projects returns an array with the correct number of members' );
32 ok( $projectList->[0]->{name} eq 'bare.git', 'list_projects has correct name for "bare.git" repo' );
33 ok( $projectList->[1]->{name} eq 'working/.git', 'list_projects has correct name for "working" repo' );
34
35 use Data::Dumper;
36 warn( Dumper($projectList) );
37
38 } # Close APP_TEST skip