X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F101_io_atomic.t;h=3e629d96898f8239ad6b607fb9d7bc268f9abd49;hb=9ca35902cc8f4c0c8695cae7ab003f94ac294639;hp=20e0aa54aae32b436e3c2aaf28d6ec2da416f756;hpb=8d8356bb0a96c1c4e909b56c812b16fc82c7bbd2;p=gitmo%2FMooseX-Storage.git diff --git a/t/101_io_atomic.t b/t/101_io_atomic.t index 20e0aa5..3e629d9 100644 --- a/t/101_io_atomic.t +++ b/t/101_io_atomic.t @@ -4,10 +4,16 @@ use strict; use warnings; use Test::More; +use File::Temp qw(tempdir); +use File::Spec::Functions; +my $dir = tempdir( CLEANUP => 1 ); + +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 $@; plan tests => 10; use_ok('MooseX::Storage'); } @@ -27,7 +33,7 @@ BEGIN { has 'object' => (is => 'ro', isa => 'Object'); } -my $file = 'temp.json'; +my $file = catfile($dir,'temp.json'); { my $foo = Foo->new( @@ -57,4 +63,3 @@ my $file = 'temp.json'; is($foo->object->number, 2, '... got the right number (in the embedded object)'); } -unlink $file;