Test::Deep is already required; use it instead of is_deeply
[gitmo/MooseX-Storage.git] / t / 008_do_not_serialize.t
index e0ff4b3..27afeb1 100644 (file)
@@ -4,7 +4,8 @@ use strict;
 use warnings;
 
 use Test::More tests => 13;
-use Test::Exception;
+use Test::Deep;
+use Test::Fatal;
 
 BEGIN {
     use_ok('MooseX::Storage');
@@ -44,7 +45,7 @@ BEGIN {
     is($foo->baz, 'BAZ', '... got the value we expected');
     is($foo->gorch, 'GORCH', '... got the value we expected');
     
-    is_deeply(
+    cmp_deeply(
         $foo->pack,
         {
             __CLASS__ => 'Foo',
@@ -65,7 +66,7 @@ BEGIN {
         metaclass   => 'DoNotSerialize',
         required    => 1,
         is          => 'rw',
-        isa         => 'Str',        # type constraint is important
+        isa         => 'Object',        # type constraint is important
     );
     
     has zot => (
@@ -74,14 +75,15 @@ 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;
-    is_deeply(
+    cmp_deeply(
         $bpack,
         {   __CLASS__   => 'Bar',
             zot         => $$,
@@ -91,8 +93,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"); 
 }