Make sure authors have all the deps
[gitmo/MooseX-Storage.git] / t / 105_io_atomic_w_utf8.t
index 6da8d3e..1c88be2 100644 (file)
@@ -4,21 +4,25 @@ use strict;
 use warnings;
 
 use Test::More;
+use File::Temp qw(tempdir);
+use File::Spec::Functions;
+my $dir = tempdir;
+
+use Test::Requires {
+    'JSON::Any' => 0.01, # skip all if not installed
+    'IO::AtomicFile' => 0.01,
+};
 
 BEGIN {  
-    eval "use IO::AtomicFile";
-    plan skip_all => "IO::AtomicFile is required for this test" if $@;        
-    eval "use JSON::Any";
-    plan skip_all => "JSON::Any is required for this test" if $@;        
     # NOTE: 
     # this is because JSON::XS is 
     # the only one which really gets
     # utf8 correct
     # - SL 
-    BEGIN { 
+    BEGIN {
         $ENV{JSON_ANY_ORDER}  = qw(XS);
         $ENV{JSON_ANY_CONFIG} = "utf8=1";        
-    }           
+    }
     plan tests => 8;
     use_ok('MooseX::Storage');
 }
@@ -39,7 +43,7 @@ use utf8;
     );
 }
 
-my $file = 'temp.json';
+my $file = catfile($dir, 'temp.json');
 
 {
     my $foo = Foo->new;
@@ -81,4 +85,3 @@ unlink $file;
       '... got the string we expected');
 }
 
-unlink $file;