convert all uses of Test::Exception to Test::Fatal
[gitmo/MooseX-Runnable.git] / t / invocation-plugin-initargs.t
index e8f5996..9e1987b 100644 (file)
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
-use Test::Exception;
-use Test::More tests => 6;
+use Test::Fatal;
+use Test::More tests => 7;
 
 use MooseX::Runnable::Invocation;
 
@@ -30,34 +30,53 @@ my $initargs;
   use Moose::Role;
 }
 
+{ package Plugin2;
+  use Moose::Role;
+  with 'MooseX::Runnable::Invocation::Plugin::Role::CmdlineArgs';
+
+  sub _build_initargs_from_cmdline {
+      return { init => 'fails' };
+  }
+}
+
 my $i;
-lives_ok {
+is exception {
     $i = MooseX::Runnable::Invocation->new(
         class => 'Class',
         plugins => {
             '+Plugin' => [qw/foo bar baz/],
         },
     );
-} 'created invocation without dying';
+}, undef, 'created invocation without dying';
 
 ok $i, 'created invocation ok';
 ok $i->run, 'ran ok';
 is $initargs, 'foo,bar,baz', 'got initargs';
 
-throws_ok {
+like exception {
     MooseX::Runnable::Invocation->new(
         class => 'Class',
         plugins => {
             '+Argless' => ['args go here'],
         },
     );
-} qr/Perhaps/, 'argless + args = error';
+}, qr/Perhaps/, 'argless + args = error';
 
-lives_ok {
+is exception {
     MooseX::Runnable::Invocation->new(
         class => 'Class',
         plugins => {
             '+Argless' => [],
         },
     );
-} 'argless + no args = ok';
+}, undef, 'argless + no args = ok';
+
+is exception {
+    MooseX::Runnable::Invocation->new(
+        class => 'Class',
+        plugins => {
+            '+Plugin' => [],
+            '+Plugin2' => [],
+        },
+    );
+}, undef, 'two plugins with args compose OK';