b647a9883be98f7a30428b5e596887c5839c0702
[gitmo/Moose.git] / t / 070_attribute_helpers / 010_array_from_role.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 2;
7 use Test::Exception;
8
9 {
10     package Foo;
11     use Moose;
12
13     has 'bar' => ( is => 'rw' );
14
15     package Stuffed::Role;
16     use Moose::Role;
17     use Moose::AttributeHelpers;
18
19     has 'options' => (
20         traits => ['Collection::Array'],
21         is     => 'ro',
22         isa    => 'ArrayRef[Foo]',
23     );
24
25     package Bulkie::Role;
26     use Moose::Role;
27     use Moose::AttributeHelpers;
28
29     has 'stuff' => (
30         traits  => ['Collection::Array'],
31         is      => 'ro',
32         isa     => 'ArrayRef',
33         handles => {
34             get_stuff => 'get',
35         }
36     );
37
38     package Stuff;
39     use Moose;
40
41     ::lives_ok{ with 'Stuffed::Role';
42         } '... this should work correctly';
43
44     ::lives_ok{ with 'Bulkie::Role';
45         } '... this should work correctly';
46 }