Make sure that applied_attribute roles don't spill over to other roles to during...
[gitmo/Moose.git] / t / 300_immutable / 010_constructor_is_not_moose.t
index 2852c55..e30d673 100644 (file)
@@ -5,10 +5,9 @@ use warnings;
 
 use Test::More;
 
-eval "use Test::Output";
-plan skip_all => "Test::Output is required for this test" if $@;
-
-plan tests => 6;
+use Test::Requires {
+    'Test::Output' => '0.01', # skip all if not installed
+};
 
 {
     package NotMoose;
@@ -26,9 +25,9 @@ plan tests => 6;
 
     extends 'NotMoose';
 
-    ::stderr_is(
+    ::stderr_like(
         sub { Foo->meta->make_immutable },
-        "Not inlining a constructor for Foo since it is not inheriting the default Moose::Object constructor\n",
+        qr/\QNot inlining 'new' for Foo since it is not inheriting the default Moose::Object::new\E\s+\QIf you are certain you don't need to inline your constructor, specify inline_constructor => 0 in your call to Foo->meta->make_immutable/,
         'got a warning that Foo may not have an inlined constructor'
     );
 }
@@ -46,16 +45,16 @@ is(
     extends 'NotMoose';
 
     ::stderr_is(
-        sub { Foo->meta->make_immutable( replace_constructor => 1 ) },
+        sub { Bar->meta->make_immutable( replace_constructor => 1 ) },
         q{},
         'no warning when replace_constructor is true'
     );
 }
 
-isnt(
-    Bar->meta->find_method_by_name('new')->body,
-    Moose::Object->can('new'),
-    'Bar->new is not inherited from NotMoose because it was inlined'
+is(
+    Bar->meta->find_method_by_name('new')->package_name,
+   'Bar',
+    'Bar->new is inlined, and not inherited from NotMoose'
 );
 
 {
@@ -102,3 +101,5 @@ isnt(
         'no warning when inheriting from a class that has already made itself immutable'
     );
 }
+
+done_testing;