Fix bad prereqs and make sure we explicitly ask for module versions we need
[gitmo/MooseX-Params-Validate.git] / t / 004_custom_cache_key.t
index a4c3110..e444690 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 
 use Test::More;
-use Test::Exception;
+use Test::Fatal;
 use Scalar::Util;
 
 {
@@ -23,32 +23,50 @@ use Scalar::Util;
 my $foo = Foo->new;
 isa_ok( $foo, 'Foo' );
 
-lives_ok {
-    $foo->bar( [ baz => 1 ], { baz => { isa => 'Int' } } );
-}
-'... successfully applied the parameter validation';
+is(
+    exception {
+        $foo->bar( [ baz => 1 ], { baz => { isa => 'Int' } } );
+    },
+    undef,
+    '... successfully applied the parameter validation'
+);
 
-throws_ok {
-    $foo->bar( [ baz => [ 1, 2, 3 ] ], { baz => { isa => 'ArrayRef' } } );
-} qr/\QThe 'baz' parameter/,
-'... successfully re-used the parameter validation for this instance';
+like(
+    exception {
+        $foo->bar( [ baz => [ 1, 2, 3 ] ], { baz => { isa => 'ArrayRef' } } );
+    },
+    qr/\QThe 'baz' parameter/,
+    '... successfully re-used the parameter validation for this instance'
+);
 
 my $foo2 = Foo->new;
 isa_ok( $foo2, 'Foo' );
 
-lives_ok {
-    $foo2->bar( [ baz => [ 1, 2, 3 ] ], { baz => { isa => 'ArrayRef' } } );
-}
-'... successfully applied the parameter validation';
+is(
+    exception {
+        $foo2->bar(
+            [ baz => [ 1, 2, 3 ] ],
+            { baz => { isa => 'ArrayRef' } }
+        );
+    },
+    undef,
+    '... successfully applied the parameter validation'
+);
 
-throws_ok {
-    $foo2->bar( [ baz => 1 ], { baz => { isa => 'Int' } } );
-} qr/\QThe 'baz' parameter/,
-'... successfully re-used the parameter validation for this instance';
+like(
+    exception {
+        $foo2->bar( [ baz => 1 ], { baz => { isa => 'Int' } } );
+    },
+    qr/\QThe 'baz' parameter/,
+    '... successfully re-used the parameter validation for this instance'
+);
 
-lives_ok {
-    $foo->bar( [ baz => 1 ], { baz => { isa => 'Int' } } );
-}
-'... successfully applied the parameter validation (just checking)';
+is(
+    exception {
+        $foo->bar( [ baz => 1 ], { baz => { isa => 'Int' } } );
+    },
+    undef,
+    '... successfully applied the parameter validation (just checking)'
+);
 
 done_testing();