Add role_for_combination to fix prole-role combination
[gitmo/MooseX-Role-Parameterized.git] / t / 150-composite-role-application.t
index 42464e6..1e0a0b0 100644 (file)
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 8;
+use Test::More tests => 7;
 use Test::Exception;
 
 do {
@@ -18,7 +18,7 @@ do {
         my $p = shift;
 
         has $p->attribute => (
-            is => 'Int',
+            is => 'rw',
         );
     };
 };
@@ -49,10 +49,8 @@ do {
          MyCompositeRoleB => { accessor  => 'bar' };
 };
 
-lives_ok {
-    ok(MyDoubleConsumer->can('foo'), 'first role in composite applied successfully');
-    ok(MyDoubleConsumer->can('bar'), 'second role in composite applied successfully');
-} 'testing composite roles lived';
+ok(MyDoubleConsumer->can('foo'), 'first role in composite applied successfully');
+ok(MyDoubleConsumer->can('bar'), 'second role in composite applied successfully');
 
 do {
     package MyExtendingRole;
@@ -77,14 +75,13 @@ do {
 do {
     package MyExtendedConsumer;
     use Moose;
-    with MyCompositeRoleA => { attribute => 'bar' },
+    with MyCompositeRoleA => { attribute => 'baz' },
          MyExtendingRole  => { foo => 23 };
 };
 
-lives_ok {
-    ok(MyExtendedConsumer->can('bar'), 'role composed through other role applied successfully');
-    is(MyExtendedConsumer->new->foo, 23, 'role composing other role applied successfully');
-} 'testing role through application through other role lived';
+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;
@@ -114,8 +111,6 @@ do {
     );
 };
 
-lives_ok {
-    ok(MyProxyConsumer->can('baz'), 'proxied role got applied successfully');
-    ok(MyProxyConsumer->can('qux'), 'other role besides proxied one got applied successfully');
-} 'testing proxied roles lived';
+ok(MyProxyConsumer->can('baz'), 'proxied role got applied successfully');
+ok(MyProxyConsumer->can('qux'), 'other role besides proxied one got applied successfully');