From: Graham Knop Date: Fri, 14 Mar 2014 08:22:26 +0000 (+0100) Subject: test role create hook X-Git-Tag: v1.003003~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=59ea1b593800dff1413942c512d338890a95908d;p=gitmo%2FRole-Tiny.git test role create hook --- diff --git a/t/create-hook.t b/t/create-hook.t new file mode 100644 index 0000000..315c9e0 --- /dev/null +++ b/t/create-hook.t @@ -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;