summaryrefslogtreecommitdiff
path: root/t/04_override_get_implementation.t
diff options
context:
space:
mode:
Diffstat (limited to 't/04_override_get_implementation.t')
-rw-r--r--t/04_override_get_implementation.t32
1 files changed, 32 insertions, 0 deletions
diff --git a/t/04_override_get_implementation.t b/t/04_override_get_implementation.t
new file mode 100644
index 0000000..d53cbf9
--- /dev/null
+++ b/t/04_override_get_implementation.t
@@ -0,0 +1,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"); \ No newline at end of file