From eeb792decae28e85e487ebeeb6d56f1994b56c62 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 21 Feb 2011 01:07:16 -0600 Subject: handle type checks and auto_deref on values returned from services --- t/30-type-checks.t | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 t/30-type-checks.t (limited to 't/30-type-checks.t') diff --git a/t/30-type-checks.t b/t/30-type-checks.t new file mode 100644 index 0000000..58f4405 --- /dev/null +++ b/t/30-type-checks.t @@ -0,0 +1,26 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; +use Test::Fatal; + +{ + package Foo; + use Moose; + use MooseX::Bread::Board; + + has foo => ( + is => 'ro', + isa => 'Ref', + value => 'FOO', + ); +} + +{ + 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"); +} + +done_testing; -- cgit v1.2.3