Make sure is => undef works
[gitmo/MooseX-IsDefaults.git] / t / 003-no-accessor.t
1 #!/usr/bin/env perl
2 use strict;
3 use warnings;
4 use Test::More tests => 5;
5 use Test::Exception;
6
7 do {
8     package Person;
9     use Moose;
10     use MooseX::IsDefaults::RO;
11
12     has name => (
13         isa => 'Str',
14     );
15
16     has blah => (
17         is        => undef,
18         predicate => 'has_blah',
19     );
20 };
21
22 can_ok(Person => qw(name));
23 ok(!Person->can('blah'));
24
25 my $person = Person->new(name => 'Joe', blah => 'secret');
26 is($person->name, 'Joe');
27 is($person->{blah}, 'secret', 'an attribute was created even though it has no accessor');
28 ok($person->has_blah);
29