Add a dummy file so that the empty repo dir shows up.
[catagits/Gitalist.git] / t / model_Git.t
CommitLineData
4805c465 1use strict;
2use warnings;
3use Test::More qw/no_plan/;
4
5BEGIN { use_ok 'Gitalist::Model::Git' }
6
7my $Git = Gitalist::Model::Git->new;
8
9# 'bare.git' is a bare git repository in the repository dir
10use Path::Class;
11my $repoBare = Path::Class::Dir->new('t/lib/repositories/bare.git');
12ok( $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
15my $repoWorking = Path::Class::Dir->new('t/lib/repositories/working');
16ok( $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
19my $repoEmpty = Path::Class::Dir->new('t/lib/repositories/empty.git');
20ok( ! $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.
24diag("*** SKIPPING app tests.
25*** Set APP_TEST for the tests to run fully") if !$ENV{APP_TEST};
26SKIP: {
27 skip "Set APP_TEST for the tests to run fully",
28 3 if !$ENV{APP_TEST};
29
30my $projectList = $Git->list_projects;
31ok( scalar @{$projectList} == 2, 'list_projects returns an array with the correct number of members' );
32ok( $projectList->[0]->{name} eq 'bare.git', 'list_projects has correct name for "bare.git" repo' );
33ok( $projectList->[1]->{name} eq 'working/.git', 'list_projects has correct name for "working" repo' );
34
35use Data::Dumper;
36warn( Dumper($projectList) );
37
38} # Close APP_TEST skip