Tasks: only execute the event if the plugin is interested in it

This commit is contained in:
Graham Christensen
2021-12-20 13:27:59 -05:00
parent 633fc36d6a
commit a14501c616
12 changed files with 150 additions and 21 deletions

View File

@ -39,6 +39,28 @@ subtest "Parsing build_queued" => sub {
);
};
subtest "interested" => sub {
my $event = Hydra::Event::BuildQueued->new(123, []);
subtest "A plugin which does not implement the API" => sub {
my $plugin = {};
my $mock = mock_obj $plugin => ();
is($event->interestedIn($plugin), 0, "The plugin is not interesting.");
};
subtest "A plugin which does implement the API" => sub {
my $plugin = {};
my $mock = mock_obj $plugin => (
add => [
"buildQueued" => sub {}
]
);
is($event->interestedIn($plugin), 1, "The plugin is interesting.");
};
};
subtest "load" => sub {
my $build = $builds->{"empty_dir"};