fix: test was expecting to be in a git repo
This commit is contained in:
parent
4c315f9a04
commit
5b832b6477
@ -4,6 +4,12 @@ project:
|
|||||||
homepage: https://git.babyl.ca/yanick/App-Changelord
|
homepage: https://git.babyl.ca/yanick/App-Changelord
|
||||||
with_stats: 1
|
with_stats: 1
|
||||||
releases:
|
releases:
|
||||||
|
- version: NEXT
|
||||||
|
date: ~
|
||||||
|
changes:
|
||||||
|
- commit: b25e98fc57307fbede9382b31fd85f3cbbc72cf7
|
||||||
|
desc: ' test was expecting to be in a git repo'
|
||||||
|
type: fix
|
||||||
- version: v0.0.1
|
- version: v0.0.1
|
||||||
date: 2022-06-25
|
date: 2022-06-25
|
||||||
changes:
|
changes:
|
||||||
|
@ -18,7 +18,7 @@ use Version::Dotted::Semantic;
|
|||||||
with 'App::Changelord::Role::Changelog';
|
with 'App::Changelord::Role::Changelog';
|
||||||
with 'App::Changelord::Role::ChangeTypes';
|
with 'App::Changelord::Role::ChangeTypes';
|
||||||
with 'App::Changelord::Role::Versions';
|
with 'App::Changelord::Role::Versions';
|
||||||
with 'App::Changelord::Role::Stats';
|
with 'App::Changelord::Role::GitRepo';
|
||||||
|
|
||||||
sub run ($self) {
|
sub run ($self) {
|
||||||
my $bump = shift @ARGV;
|
my $bump = shift @ARGV;
|
||||||
|
@ -39,16 +39,11 @@ capture a C<type> and C<ticket> as well.
|
|||||||
END_POD
|
END_POD
|
||||||
|
|
||||||
use Path::Tiny;
|
use Path::Tiny;
|
||||||
use Git::Repository;
|
|
||||||
|
|
||||||
with 'App::Changelord::Role::Changelog';
|
with 'App::Changelord::Role::Changelog';
|
||||||
with 'App::Changelord::Role::Versions';
|
with 'App::Changelord::Role::Versions';
|
||||||
with 'App::Changelord::Role::ChangeTypes';
|
with 'App::Changelord::Role::ChangeTypes';
|
||||||
|
with 'App::Changelord::Role::GitRepo';
|
||||||
has repo => (
|
|
||||||
is => 'ro',
|
|
||||||
default => sub { Git::Repository->new( work_tree => '.' ) },
|
|
||||||
);
|
|
||||||
|
|
||||||
has commit_regex => (
|
has commit_regex => (
|
||||||
is => 'lazy'
|
is => 'lazy'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package App::Changelord::Role::Stats;
|
package App::Changelord::Role::GitRepo;
|
||||||
|
|
||||||
use v5.36.0;
|
use v5.36.0;
|
||||||
|
|
||||||
@ -13,12 +13,13 @@ requires 'changelog';
|
|||||||
# stolen from Dist::Zilla::Plugin::ChangeStats::Git
|
# stolen from Dist::Zilla::Plugin::ChangeStats::Git
|
||||||
|
|
||||||
has repo => (
|
has repo => (
|
||||||
is => 'ro',
|
is => 'lazy',
|
||||||
default => sub { Git::Repository->new( work_tree => '.' ) },
|
default => sub {
|
||||||
|
Git::Repository->new( work_tree => '.' )
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
has stats => (
|
has stats => ( is => 'lazy' );
|
||||||
is => 'lazy' );
|
|
||||||
|
|
||||||
sub _build_stats ($self) {
|
sub _build_stats ($self) {
|
||||||
my $comparison_data = $self->_get_comparison_data or return;
|
my $comparison_data = $self->_get_comparison_data or return;
|
14
t/stats.t
14
t/stats.t
@ -15,12 +15,22 @@ package TestMe {
|
|||||||
}}
|
}}
|
||||||
);
|
);
|
||||||
|
|
||||||
with 'App::Changelord::Role::Stats';
|
with 'App::Changelord::Role::GitRepo';
|
||||||
with 'App::Changelord::Role::ChangeTypes';
|
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: /;
|
like $test->stats => qr/code churn: /;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user