X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fgit-codeowners;a=blobdiff_plain;f=t%2Fapp-codeowners.t;h=5ec78cb8e9b37295e94b231ea38f4e862cb80b68;hp=28309d3861ca0b802cf938133128494302850377;hb=d7841cb4430c9f7b3529b156fe1c2d599071cfa5;hpb=c76921e636493d2af705117fd58c642e90584d77 diff --git a/t/app-codeowners.t b/t/app-codeowners.t index 28309d3..5ec78cb 100644 --- a/t/app-codeowners.t +++ b/t/app-codeowners.t @@ -72,6 +72,25 @@ END }; }; +subtest 'create' => sub { + plan skip_all => 'Cannot run git' if !$can_git; + + my $repodir = _setup_git_repo(); + my $chdir = pushd($repodir); + + my $codeowners_filepath = path('CODEOWNERS'); + $codeowners_filepath->remove; + + my ($stdout, $stderr, $exit) = run { App::Codeowners->main(qw{create}) }; + is($exit, 0, 'exited without error'); + is($stderr, "Wrote CODEOWNERS\n", 'reportedly wrote a CODEOWNERS file'); + + ok($codeowners_filepath->is_file, 'did write CODEOWNERS file'); + + my $contents = $codeowners_filepath->slurp_utf8; + like($contents, qr/^# This file shows mappings/, 'correct contents of file') or diag $contents; +}; + done_testing; exit;