X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F060_compat%2F001_module_refresh_compat.t;h=2eb8e094d8acbf39fe2b53fa8bddc6dd90e7b28c;hb=bbf62397d81d046a716776f756249e22c4ddf372;hp=7ba140705c29ff7580955195b076044a976a2782;hpb=a28e50e44945358d15eb19e4688573741a319fe0;p=gitmo%2FMoose.git diff --git a/t/060_compat/001_module_refresh_compat.t b/t/060_compat/001_module_refresh_compat.t index 7ba1407..2eb8e09 100644 --- a/t/060_compat/001_module_refresh_compat.t +++ b/t/060_compat/001_module_refresh_compat.t @@ -6,12 +6,14 @@ use warnings; use lib 't/lib', 'lib'; use Test::More; -use Test::Exception; +use Test::Fatal; -BEGIN { - eval "use Module::Refresh;"; - plan skip_all => "Module::Refresh is required for this test" if $@; -} +use File::Spec; +use File::Temp 'tempdir'; + +use Test::Requires { + 'Module::Refresh' => '0.01', # skip all if not installed +}; =pod @@ -26,9 +28,9 @@ do { is($_->meta->name, $_, '... initialized the meta correctly'); - lives_ok { + is( exception { Module::Refresh->new->refresh_module($_ . '.pm') - } '... successfully refreshed ' . $_; + }, undef, '... successfully refreshed ' ); } foreach @modules; =pod @@ -38,7 +40,10 @@ and actually change the module itself. =cut -my $test_module_file = 'TestBaz.pm'; +my $dir = tempdir( "MooseTest-XXXXX", CLEANUP => 1, TMPDIR => 1 ); +push @INC, $dir; + +my $test_module_file = File::Spec->catdir($dir, 'TestBaz.pm'); my $test_module_source_1 = q| package TestBaz; @@ -74,9 +79,9 @@ ok(!TestBaz->isa('Foo'), '... TestBaz is not a Foo'); close FILE; } -lives_ok { - Module::Refresh->new->refresh_module($test_module_file) -} '... successfully refreshed ' . $test_module_file; +is( exception { + Module::Refresh->new->refresh_module('TestBaz.pm') +}, undef, '... successfully refreshed ' ); is(TestBaz->meta->name, 'TestBaz', '... initialized the meta correctly'); ok(TestBaz->meta->has_attribute('foo'), '... it has the foo attribute as well');