-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathRunner-rebuild-on-undef-last-run-time.t
104 lines (83 loc) · 1.91 KB
/
Runner-rebuild-on-undef-last-run-time.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
## no critic (Moose::RequireCleanNamespace, Moose::RequireMakeImmutable, Modules::ProhibitMultiplePackages)
use strict;
use warnings;
use Stepford::Runner;
use Test::More;
my $ran_step_1;
my $ran_step_2;
my $ran_step_3;
{
package Test::Step::Step1;
use Moose;
use Stepford::Types qw( Str );
with 'Stepford::Role::Step';
has str1 => (
traits => ['StepProduction'],
is => 'ro',
isa => Str,
default => sub { 1 },
);
sub run {
$ran_step_1 = 1;
}
sub last_run_time { undef }
}
{
package Test::Step::Step2;
use Moose;
use Stepford::Types qw( Str );
with 'Stepford::Role::Step';
has str1 => (
traits => ['StepDependency'],
is => 'ro',
isa => Str,
required => 1,
);
has str2 => (
traits => ['StepProduction'],
is => 'ro',
isa => Str,
default => sub { 'str2' },
);
sub run {
$ran_step_2 = 1;
}
sub last_run_time { 1 }
}
{
package Test::Step::Step3;
use Moose;
use Stepford::Types qw( Str );
with 'Stepford::Role::Step';
has str2 => (
traits => ['StepDependency'],
is => 'ro',
isa => Str,
required => 1,
);
has str3 => (
traits => ['StepProduction'],
is => 'rw',
isa => Str,
default => sub { 'str3' },
);
sub run {
$ran_step_3 = 1;
}
sub last_run_time { 2 }
}
{
my $runner = Stepford::Runner->new(
step_namespaces => 'Test::Step',
);
$runner->run(
final_steps => 'Test::Step::Step3',
);
ok( $ran_step_1, 'Step 1 with undef last_run_time ran' );
ok( $ran_step_2, 'Step 2 with dependency with undef last_run_time' );
ok(
!$ran_step_3,
'Step 3 with dependency with older last_run_time did not run',
);
}
done_testing();