From: Shawn M Moore Date: Sun, 10 May 2009 03:36:37 +0000 (-0400) Subject: Add role_for_combination to fix prole-role combination X-Git-Tag: 0.06~14 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=592ff67cca1f2c1f0a20b4b9882ff1d9565d80be;p=gitmo%2FMooseX-Role-Parameterized.git Add role_for_combination to fix prole-role combination --- diff --git a/lib/MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm b/lib/MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm index b3d3d43..59529ee 100644 --- a/lib/MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm +++ b/lib/MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm @@ -83,6 +83,15 @@ sub generate_role { return $role; } +sub role_for_combination { + my $self = shift; + my $parameters = shift; + + return $self->generate_role( + parameters => $parameters, + ); +} + sub apply { my $self = shift; my $consumer = shift; diff --git a/t/150-composite-role-application.t b/t/150-composite-role-application.t index 1e2e203..1e0a0b0 100644 --- a/t/150-composite-role-application.t +++ b/t/150-composite-role-application.t @@ -49,11 +49,8 @@ do { MyCompositeRoleB => { accessor => 'bar' }; }; -TODO: { - local $TODO = "role-role application for parameterized roles doesn't work yet"; - ok(MyDoubleConsumer->can('foo'), 'first role in composite applied successfully'); - ok(MyDoubleConsumer->can('bar'), 'second role in composite applied successfully'); -}; +ok(MyDoubleConsumer->can('foo'), 'first role in composite applied successfully'); +ok(MyDoubleConsumer->can('bar'), 'second role in composite applied successfully'); do { package MyExtendingRole; @@ -82,12 +79,9 @@ do { MyExtendingRole => { foo => 23 }; }; -TODO: { - local $TODO = "role-role application for parameterized roles doesn't work yet"; - ok(MyExtendedConsumer->can('baz'), 'role composed directly applied successfully'); - ok(MyExtendedConsumer->can('bar'), 'role composed through other role applied successfully'); - is(eval { MyExtendedConsumer->new->foo }, 23, 'role composing other role applied successfully'); -};; +ok(MyExtendedConsumer->can('baz'), 'role composed directly applied successfully'); +ok(MyExtendedConsumer->can('bar'), 'role composed through other role applied successfully'); +is(eval { MyExtendedConsumer->new->foo }, 23, 'role composing other role applied successfully'); do { package MyRoleProxy; @@ -117,9 +111,6 @@ do { ); }; -TODO: { - local $TODO = "role-role application for parameterized roles doesn't work yet"; - ok(MyProxyConsumer->can('baz'), 'proxied role got applied successfully'); - ok(MyProxyConsumer->can('qux'), 'other role besides proxied one got applied successfully'); -}; +ok(MyProxyConsumer->can('baz'), 'proxied role got applied successfully'); +ok(MyProxyConsumer->can('qux'), 'other role besides proxied one got applied successfully');