3 use File::Temp qw( tempdir );
5 use System::Introspector::Probe::Repositories::Git;
7 plan skip_all => q{Tests require a git executable}
10 my $dir = tempdir(CLEANUP => 1);
12 no warnings 'redefine';
13 *System::Introspector::Probe::Repositories::Git::_open_locate_git_config_pipe = sub {
14 my $output = "$dir/.git/config\n";
15 open my $fh, '<', \$output;
19 system("GIT_DIR=$dir/.git git init > /dev/null");
21 my $probe = System::Introspector::Probe::Repositories::Git->new(
25 my $result = $probe->gather;
26 ok $result, 'received data';
27 my $data = $result->{git};
28 ok $data, 'received git data';
29 is scalar(keys %$data), 1, 'found single git repository';
31 my $wc = $data->{ $dir };
32 ok $wc, 'our temp repository exists in the data';
33 ok scalar(keys %{$wc->{config}||{}}), 'received config values';