summaryrefslogtreecommitdiffstats
path: root/t/40-mop.t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2011-02-21 02:00:06 -0600
committerJesse Luehrs <doy@tozt.net>2011-02-21 02:00:06 -0600
commit0a7125e470e2067f75faf81f7e1890bc402e5e98 (patch)
treea6dd03e113cf77e50096307615f6225b0fc8c4b4 /t/40-mop.t
parent06f919c57dfc917e50e6858100cfbe3a1b57a1be (diff)
downloadbread-board-declare-0a7125e470e2067f75faf81f7e1890bc402e5e98.tar.gz
bread-board-declare-0a7125e470e2067f75faf81f7e1890bc402e5e98.zip
test for mop stuff
Diffstat (limited to 't/40-mop.t')
-rw-r--r--t/40-mop.t38
1 files changed, 38 insertions, 0 deletions
diff --git a/t/40-mop.t b/t/40-mop.t
new file mode 100644
index 0000000..c8f0dd9
--- /dev/null
+++ b/t/40-mop.t
@@ -0,0 +1,38 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+{
+ package Foo;
+ use Moose;
+ use MooseX::Bread::Board;
+
+ has foo => (
+ is => 'ro',
+ isa => 'Str',
+ value => 'FOO',
+ );
+
+ has bar => (
+ is => 'ro',
+ isa => 'Str',
+ block => sub {
+ my $s = shift;
+ return $s->param('foo') . 'BAR';
+ },
+ dependencies => ['foo'],
+ );
+}
+
+{
+ my $foo = Foo->new;
+ my $foo_attr = $foo->meta->get_attribute('foo');
+ my $bar_attr = $foo->meta->get_attribute('bar');
+ is($foo_attr->get_value($foo), 'FOO', "right value");
+ is($bar_attr->get_value($foo), 'FOOBAR', "right value");
+ ok(!$foo_attr->has_value($foo), "no value");
+ ok(!$bar_attr->has_value($foo), "no value");
+}
+
+done_testing;