1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use Test::More;
7use Test::Moose;
8use Scalar::Util 'blessed';
9
10use Bread::Board::BlockInjection;
11use Bread::Board::Literal;
12
13my $s = Bread::Board::BlockInjection->new(
14    name  => 'NoClass',
15    block => sub {
16        my $s = shift;
17        return +{ foo => $s->param('foo') }
18    },
19    dependencies => {
20        foo => Bread::Board::Literal->new( name => 'foo', value => 'FOO' )
21    }
22);
23isa_ok($s, 'Bread::Board::BlockInjection');
24does_ok($s, 'Bread::Board::Service::WithDependencies');
25does_ok($s, 'Bread::Board::Service::WithParameters');
26does_ok($s, 'Bread::Board::Service');
27
28my $x = $s->get;
29ok( !blessed($x), '... the result of the block injection is not blessed');
30
31is_deeply($x, { foo => 'FOO' }, '... block injections can return unblessed values');
32
33done_testing;
34