Commits

Diab Jerius  committed 79b3232

add role which instantiates an Hg::Lib object

  • Participants
  • Parent commits b3ef17a

Comments (0)

Files changed (1)

File t/lib/Test/Hg/Lib/Role/Client.pm

+#! perl
+
+package Test::Hg::Lib::Role::Client;
+
+use File::Spec::Functions qw[ curdir ];
+
+use Moo::Role;
+
+use Hg::Lib;
+
+has dir => (
+    is        => 'ro',
+    default   => curdir,
+);
+
+has client => (
+    is      => 'lazy',
+    init_args => undef,
+    clearer => 1,
+);
+
+sub _build_client { Hg::Lib::init( shift->dir ) }
+
+before each_test => sub {
+
+    $_[0]->client;
+};
+
+after each_test => sub {
+
+    $_[0]->clear_client;
+
+};
+
+
+1;
+