X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Faggregate%2Funit_core_script_create.t;h=a27dc2542cdf4e7261b63e1789bfb88a5ffd3a38;hb=a0b5065e3dd43fea2ca17f4f2ae7cbe1958057d4;hp=db2e5afdc40f15f5c01f8f36bac4aab306d4e709;hpb=0a33c6d347b1f545a3b573eee8056fae6ccb0829;p=catagits%2FCatalyst-Runtime.git diff --git a/t/aggregate/unit_core_script_create.t b/t/aggregate/unit_core_script_create.t index db2e5af..a27dc25 100644 --- a/t/aggregate/unit_core_script_create.t +++ b/t/aggregate/unit_core_script_create.t @@ -1,8 +1,7 @@ -#!/usr/bin/env perl use strict; use warnings; use Test::More; -use Test::Exception; +use Test::Fatal; use FindBin qw/$Bin/; use lib "$Bin/../lib"; @@ -12,13 +11,13 @@ use lib "$Bin/../lib"; use Moose; extends 'Catalyst::Script::Create'; our $help; - sub _exit_with_usage { $help++ } + sub print_usage_text { $help++ } } { package TestHelperClass; use Moose; - + has 'newfiles' => ( is => 'ro', init_arg => '.newfiles' ); has 'mech' => ( is => 'ro' ); our @ARGS; @@ -41,9 +40,9 @@ use lib "$Bin/../lib"; { local $TestCreateScript::help; local @ARGV; - lives_ok { + is exception { TestCreateScript->new_with_options(application_name => 'TestAppToTestScripts', helper_class => 'TestHelperClass')->run; - } "no argv"; + }, undef, "no argv"; ok $TestCreateScript::help, 'Exited with usage info'; } { @@ -51,9 +50,9 @@ use lib "$Bin/../lib"; local @ARGV = 'foo'; local @TestHelperClass::ARGS; local %TestHelperClass::p; - lives_ok { + is exception { TestCreateScript->new_with_options(application_name => 'TestAppToTestScripts', helper_class => 'TestHelperClass')->run; - } "with argv"; + }, undef, "with argv"; ok !$TestCreateScript::help, 'Did not exit with usage into'; is_deeply \@TestHelperClass::ARGS, ['TestAppToTestScripts', 'foo'], 'Args correct'; is_deeply \%TestHelperClass::p, { '.newfiles' => 1, mech => undef }, 'Params correct'; @@ -64,9 +63,9 @@ use lib "$Bin/../lib"; local @ARGV = 'foo'; local @TestHelperClass::ARGS; local %TestHelperClass::p; - lives_ok { + is exception { TestCreateScript->new_with_options(application_name => 'TestAppToTestScripts', helper_class => 'TestHelperClass::False')->run; - } "with argv"; + }, undef, "with argv"; ok $TestCreateScript::help, 'Did exit with usage into as mk_component returned false'; is_deeply \@TestHelperClass::ARGS, ['TestAppToTestScripts', 'foo'], 'Args correct'; is_deeply \%TestHelperClass::p, { '.newfiles' => 1, mech => undef }, 'Params correct';