Tidy code and remove unneeded module loads
[gitmo/Moose.git] / t / 300_immutable / 002_apply_roles_to_immutable.t
index 6149a1d..7739b24 100644 (file)
@@ -3,18 +3,15 @@
 use strict;
 use warnings;
 
-use Test::More no_plan => 1;
-use Test::Exception;
+use Test::More;
+use Test::Fatal;
 
-BEGIN {
-    use_ok('Moose');
-}
 
 {
     package My::Role;
     use Moose::Role;
-    
-    around 'baz' => sub { 
+
+    around 'baz' => sub {
         my $next = shift;
         'My::Role::baz(' . $next->(@_) . ')';
     };
@@ -23,10 +20,10 @@ BEGIN {
 {
     package Foo;
     use Moose;
-    
+
     sub baz { 'Foo::baz' }
-    
-       metaclass->make_immutable(debug => 0);
+
+    __PACKAGE__->meta->make_immutable(debug => 0);
 }
 
 my $foo = Foo->new;
@@ -34,10 +31,10 @@ isa_ok($foo, 'Foo');
 
 is($foo->baz, 'Foo::baz', '... got the right value');
 
-lives_ok {
+ok ! exception {
     My::Role->meta->apply($foo)
-} '... successfully applied the role to immutable instance';
+}, '... successfully applied the role to immutable instance';
 
 is($foo->baz, 'My::Role::baz(Foo::baz)', '... got the right value');
 
-
+done_testing;