use_ok stinks; just load the library
[gitmo/Moose-Autobox.git] / t / 003_p6_example.t
index 65845a5..b9963f6 100644 (file)
@@ -3,17 +3,21 @@
 use strict;
 use warnings;
 
-use Test::More tests => 8;
+use Test::More tests => 7;
 use Test::Exception;
 
-BEGIN {
-    use_ok('Moose::Autobox');
-}
+require Moose::Autobox;
+
+=pod
+
+This comes from one of the examples in the Pugs distro.
+
+=cut
 
 {
     package Units::Bytes;
     use Moose::Role;
-    use autobox;
+    use Moose::Autobox;
     
     sub bytes     { $_[0]                   }    
     sub kilobytes { $_[0] * 1024            }
@@ -31,18 +35,14 @@ BEGIN {
     }
 }
 
-{
-    package SCALAR;
-    use Moose;
-    with 'Units::Bytes';
-}
+Moose::Autobox->mixin_additional_role(SCALAR => 'Units::Bytes');
 
 sub testing_bytes {
     ::dies_ok { 10->bytes } '... cannot do the autoboxing lexically';
 }
 
 {
-    use autobox;
+    use Moose::Autobox;
 
     is(5->bytes,     5,             '... got 5 bytes');
     is(5->kilobytes, 5120,          '... got 5 kilobytes');