summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2011-02-20 02:29:50 -0600
committerJesse Luehrs <doy@tozt.net>2011-02-20 02:29:50 -0600
commit9a259f4341c60b2fb9ddc3aefc640081ead9f078 (patch)
tree74857633ae0093616434f8b0ea84e7199cd159ee /t
parent56ea4c74c3ba642899a736eff7270067c6738020 (diff)
downloadbread-board-declare-9a259f4341c60b2fb9ddc3aefc640081ead9f078.tar.gz
bread-board-declare-9a259f4341c60b2fb9ddc3aefc640081ead9f078.zip
pass $self to block injections
Diffstat (limited to 't')
-rw-r--r--t/04-block.t39
1 files changed, 39 insertions, 0 deletions
diff --git a/t/04-block.t b/t/04-block.t
new file mode 100644
index 0000000..a06a950
--- /dev/null
+++ b/t/04-block.t
@@ -0,0 +1,39 @@
+#!/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',
+ default => 'FOO',
+ );
+
+ has bar => (
+ is => 'ro',
+ isa => 'Str',
+ value => 'BAR',
+ );
+
+ has baz => (
+ is => 'ro',
+ isa => 'Baz',
+ block => sub {
+ my ($s, $self) = @_;
+ return $s->param('bar') . $self->foo;
+ },
+ dependencies => ['bar'],
+ );
+}
+
+{
+ my $foo = Foo->new;
+ is($foo->baz, 'BARFOO', "self is passed properly");
+}
+
+done_testing;