fix: test was expecting to be in a git repo

This commit is contained in:
Yanick Champoux 2022-07-25 16:51:04 -04:00
parent 4c315f9a04
commit 5b832b6477
5 changed files with 26 additions and 14 deletions

View File

@ -4,6 +4,12 @@ project:
homepage: https://git.babyl.ca/yanick/App-Changelord
with_stats: 1
releases:
- version: NEXT
date: ~
changes:
- commit: b25e98fc57307fbede9382b31fd85f3cbbc72cf7
desc: ' test was expecting to be in a git repo'
type: fix
- version: v0.0.1
date: 2022-06-25
changes:

View File

@ -18,7 +18,7 @@ use Version::Dotted::Semantic;
with 'App::Changelord::Role::Changelog';
with 'App::Changelord::Role::ChangeTypes';
with 'App::Changelord::Role::Versions';
with 'App::Changelord::Role::Stats';
with 'App::Changelord::Role::GitRepo';
sub run ($self) {
my $bump = shift @ARGV;

View File

@ -39,16 +39,11 @@ capture a C<type> and C<ticket> as well.
END_POD
use Path::Tiny;
use Git::Repository;
with 'App::Changelord::Role::Changelog';
with 'App::Changelord::Role::Versions';
with 'App::Changelord::Role::ChangeTypes';
has repo => (
is => 'ro',
default => sub { Git::Repository->new( work_tree => '.' ) },
);
with 'App::Changelord::Role::GitRepo';
has commit_regex => (
is => 'lazy'

View File

@ -1,4 +1,4 @@
package App::Changelord::Role::Stats;
package App::Changelord::Role::GitRepo;
use v5.36.0;
@ -13,12 +13,13 @@ requires 'changelog';
# stolen from Dist::Zilla::Plugin::ChangeStats::Git
has repo => (
is => 'ro',
default => sub { Git::Repository->new( work_tree => '.' ) },
is => 'lazy',
default => sub {
Git::Repository->new( work_tree => '.' )
},
);
has stats => (
is => 'lazy' );
has stats => ( is => 'lazy' );
sub _build_stats ($self) {
my $comparison_data = $self->_get_comparison_data or return;

View File

@ -15,12 +15,22 @@ package TestMe {
}}
);
with 'App::Changelord::Role::Stats';
with 'App::Changelord::Role::GitRepo';
with 'App::Changelord::Role::ChangeTypes';
}
my $test = TestMe->new;
package TestRepo {
use Moo;
sub run(@args) {
return 'blah blah';
}
}
my $test = TestMe->new(
repo => TestRepo->new,
);
like $test->stats => qr/code churn: /;