diff options
author | Jesse Luehrs <doy@tozt.net> | 2011-02-21 01:18:10 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2011-02-21 01:18:10 -0600 |
commit | 209100060d31fc0ac64676dea89adb6b8b0c1fb5 (patch) | |
tree | 910a72932aec72628cab82b4e77ada16c20ee7de /t/32-defaults.t | |
parent | eeb792decae28e85e487ebeeb6d56f1994b56c62 (diff) | |
download | bread-board-declare-209100060d31fc0ac64676dea89adb6b8b0c1fb5.tar.gz bread-board-declare-209100060d31fc0ac64676dea89adb6b8b0c1fb5.zip |
die if a default is set in a service attribute
Diffstat (limited to 't/32-defaults.t')
-rw-r--r-- | t/32-defaults.t | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/t/32-defaults.t b/t/32-defaults.t new file mode 100644 index 0000000..d3f1485 --- /dev/null +++ b/t/32-defaults.t @@ -0,0 +1,55 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; +use Test::Fatal; + +{ + package Foo; + use Moose; + use MooseX::Bread::Board; + + ::like(::exception { + has foo => ( + is => 'ro', + isa => 'Str', + default => 'OOF', + value => 'FOO', + ); + }, qr/default is not valid when Bread::Board service options are set/, + "can't set a default when creating a service"); + + ::like(::exception { + has bar => ( + is => 'ro', + isa => 'Str', + default => sub { 'OOF' }, + value => 'FOO', + ); + }, qr/default is not valid when Bread::Board service options are set/, + "can't set a default when creating a service"); + + ::like(::exception { + has baz => ( + is => 'ro', + isa => 'Str', + lazy => 1, + default => 'OOF', + value => 'FOO', + ); + }, qr/default is not valid when Bread::Board service options are set/, + "can't set a default when creating a service"); + + ::like(::exception { + has quux => ( + is => 'ro', + isa => 'Str', + lazy => 1, + default => sub { 'OOF' }, + value => 'FOO', + ); + }, qr/default is not valid when Bread::Board service options are set/, + "can't set a default when creating a service"); +} + +done_testing; |