11 sub a_role_method { 'foo' }
25 my $instance_with_role1 = Foo->new;
26 MyRole1->meta->apply($instance_with_role1);
28 my $instance_with_role2 = Foo->new;
29 MyRole2->meta->apply($instance_with_role2);
31 ok ((not $instance_with_role2->does('MyRole1')),
32 'instance does not have the wrong role');
34 ok ((not $instance_with_role2->can('a_role_method')),
35 'instance does not have methods from the wrong role');
37 ok (($instance_with_role1->does('MyRole1')),
38 'role was applied to the correct instance');
41 is $instance_with_role1->a_role_method, 'foo'
42 }, undef, 'instance has correct role method' );