[SCM] libmessage-passing-perl Debian packaging branch, master, updated. debian/0.111-3-14-g44f6e88
Tomas Doran
bobtfish at bobtfish.net
Mon May 6 11:56:58 UTC 2013
The following commit has been merged in the master branch:
commit 5ca556552c931be11a0c0a57a52f89e700efe9ac
Author: Tomas Doran <bobtfish at bobtfish.net>
Date: Wed May 23 02:54:22 2012 +0100
Add some tests, rename builder to be consistent
diff --git a/lib/Log/Stash/Role/HasAConnection.pm b/lib/Log/Stash/Role/HasAConnection.pm
index 637928e..760ae63 100644
--- a/lib/Log/Stash/Role/HasAConnection.pm
+++ b/lib/Log/Stash/Role/HasAConnection.pm
@@ -2,13 +2,13 @@ package Log::Stash::Role::HasAConnection;
use Moose::Role;
use namespace::autoclean;
-requires '_build_connection', 'connected';
+requires '_build_connection_manager', 'connected';
has connection_manager => (
is => 'ro',
lazy => 1,
#isa => ->can('subscribe_to_connect')
- builder => '_build_connection',
+ builder => '_build_connection_manager',
);
sub BUILD {}
diff --git a/t/role_hasaconnection.t b/t/role_hasaconnection.t
new file mode 100644
index 0000000..f651f3e
--- /dev/null
+++ b/t/role_hasaconnection.t
@@ -0,0 +1,40 @@
+use strict;
+use warnings;
+use Test::More;
+
+BEGIN {
+ use_ok('Log::Stash::Role::HasAConnection');
+}
+
+{
+ package TestConnectionManager;
+ use Moose;
+ use namespace::clean -except => 'meta';
+
+ our @THINGS;
+ sub subscribe_to_connect {
+ my ($self, $thing) = @_;
+ push(@THINGS, $thing);
+ }
+
+}
+{
+ package TestWithConnection;
+ use Moose;
+ use namespace::clean -except => 'meta';
+
+ with 'Log::Stash::Role::HasAConnection';
+
+ sub connected {} # Callback API
+
+ sub _build_connection_manager { TestConnectionManager->new }
+
+}
+
+my $i = TestWithConnection->new;
+ok $i;
+is scalar(@TestConnectionManager::THINGS), 1;
+is $TestConnectionManager::THINGS[0], $i;
+
+done_testing;
+
--
libmessage-passing-perl Debian packaging
More information about the Pkg-perl-cvs-commits
mailing list