Run author side tests always
[gitmo/MooseX-Storage.git] / t / 102_io_storable_file.t
index e0a90a0..2428df6 100644 (file)
@@ -4,6 +4,9 @@ use strict;
 use warnings;
 
 use Test::More tests => 10;
+use File::Temp qw(tempdir);
+use File::Spec::Functions;
+my $dir = tempdir( CLEANUP => 1 );
 
 BEGIN {
     use_ok('MooseX::Storage');
@@ -13,18 +16,18 @@ BEGIN {
     package Foo;
     use Moose;
     use MooseX::Storage;
-    
+
     with Storage(io => 'StorableFile');
-    
+
     has 'number' => (is => 'ro', isa => 'Int');
     has 'string' => (is => 'ro', isa => 'Str');
-    has 'float'  => (is => 'ro', isa => 'Num');        
+    has 'float'  => (is => 'ro', isa => 'Num');
     has 'array'  => (is => 'ro', isa => 'ArrayRef');
-    has 'hash'   => (is => 'ro', isa => 'HashRef');    
-       has 'object' => (is => 'ro', isa => 'Object');    
+    has 'hash'   => (is => 'ro', isa => 'HashRef');
+       has 'object' => (is => 'ro', isa => 'Object');
 }
 
-my $file = 'temp.storable';
+my $file = catfile($dir,'temp.storable');
 
 {
     my $foo = Foo->new(
@@ -54,4 +57,3 @@ my $file = 'temp.storable';
     is($foo->object->number, 2, '... got the right number (in the embedded object)');
 }
 
-unlink $file;