summaryrefslogtreecommitdiffstats
path: root/t/30-type-checks.t
blob: bca6134d7982d50a08f60615aa9232a1032ccd3f (plain) (blame)
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
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use Test::Fatal;
use Test::Moose;

{
    package Foo;
    use Moose;
    use MooseX::Bread::Board;

    has foo => (
        is    => 'ro',
        isa   => 'Ref',
        value => 'FOO',
    );
}

with_immutable {
    my $foo = Foo->new;
    like(exception { $foo->foo },
        qr/^Attribute \(foo\) does not pass the type constraint because: Validation failed for 'Ref' with value FOO/,
         "error when service returns invalid value");
} 'Foo';

done_testing;