Make sure authors have all the deps
[gitmo/MooseX-Storage.git] / t / 008_do_not_serialize.t
index e0ff4b3..200e90b 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 
 use Test::More tests => 13;
-use Test::Exception;
+use Test::Fatal;
 
 BEGIN {
     use_ok('MooseX::Storage');
@@ -65,7 +65,7 @@ BEGIN {
         metaclass   => 'DoNotSerialize',
         required    => 1,
         is          => 'rw',
-        isa         => 'Str',        # type constraint is important
+        isa         => 'Object',        # type constraint is important
     );
     
     has zot => (
@@ -74,10 +74,11 @@ BEGIN {
     );        
 }
 
-{   my $bar = Bar->new( foo => $$ );
+{   my $obj = bless {};
+    my $bar = Bar->new( foo => $obj );
     
     ok( $bar,                   "New object created" );
-    is( $bar->foo, $$,          "   ->foo => $$" );
+    is( $bar->foo, $obj,        "   ->foo => $obj" );
     is( $bar->zot, $$,          "   ->zot => $$" );
     
     my $bpack = $bar->pack;
@@ -91,8 +92,8 @@ BEGIN {
     ok( $@,                     "   Unpack without required attribute fails" );
     like( $@, qr/foo/,          "       Proper error recorded" );
         
-    my $bar2 = Bar->unpack({ %$bpack, foo => $$ });
-    ok( $bar2,                  "   Unpacked correctly with foo => $$"); 
+    my $bar2 = Bar->unpack( $bpack, inject => { foo => bless {} } );
+    ok( $bar2,                  "   Unpacked correctly with foo => Object"); 
 }