/
001-basic.t
42 lines (30 loc) · 859 Bytes
/
001-basic.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
use Test::More;
use strict;
use warnings;
{
package PushedButton;
use Moose;
extends 'Announcements::Announcement';
package Button;
use Moose;
with 'Announcements::Announcing';
sub push {
my $self = shift;
$self->announce(PushedButton->new);
}
}
my $nuke = Button->new;
my ($inner_announcement, $inner_announcer, $inner_subscription);
my $subscription = Announcements::Subscription->new(
when => 'PushedButton',
do => sub {
($inner_announcement, $inner_announcer, $inner_subscription) = @_;
my $announcement = shift;
isa_ok $announcement, 'PushedButton';
},
);
$nuke->add_subscription($subscription);
$nuke->push;
is($inner_subscription, $subscription, 'same subscription object');
is($inner_announcer, $nuke, 'same announcer object');
done_testing;