summaryrefslogtreecommitdiff
path: root/t/04_override_get_implementation.t
blob: d53cbf95363851570176f7de259d78a9c90f9d73 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use Test::More tests => 2;
use Test::Moose;
use Test::Exception;

BEGIN {
	package Bar::Implementation;
	use Moose;

	has connection => (is => 'ro', isa => 'Str');

	sub tweak { 1; };

	package My::Factory;
	use MooseX::AbstractFactory;

	sub _get_implementation_class {
		my ($self, $impl) = @_;
		
		return "Bar::" . $impl;
	}
}

my $imp;

lives_ok { 
	$imp = My::Factory->create(
    	'Implementation',
    	{ connection => 'Type1' }
	);
} "Factory->new() doesn't die";

isa_ok($imp, "Bar::Implementation");