test role create hook
Graham Knop [Fri, 14 Mar 2014 08:22:26 +0000 (09:22 +0100)]
t/create-hook.t [new file with mode: 0644]

diff --git a/t/create-hook.t b/t/create-hook.t
new file mode 100644 (file)
index 0000000..315c9e0
--- /dev/null
@@ -0,0 +1,26 @@
+use strict;
+use warnings FATAL => 'all';
+use Test::More;
+
+use Role::Tiny ();
+
+my $last_role;
+push @Role::Tiny::ON_ROLE_CREATE, sub {
+  ($last_role) = @_;
+};
+
+eval q{
+  package MyRole;
+  use Role::Tiny;
+};
+
+is $last_role, 'MyRole', 'role create hook was run';
+
+eval q{
+  package MyRole2;
+  use Role::Tiny;
+};
+
+is $last_role, 'MyRole2', 'role create hook was run again';
+
+done_testing;