build_requires 'Test::More' => '0.42';
build_requires 'Test::Deep' => '0';
build_requires 'Test::Exception' => '0';
+build_requires 'File::Temp' => '0';
auto_install;
WriteAll;
use warnings;
use Test::More;
+use File::Temp qw(tempdir);
+use File::Spec::Functions;
+my $dir = tempdir( CLEANUP => 1 );
BEGIN {
eval "use JSON::Any";
has 'object' => (is => 'ro', isa => 'Object');
}
-my $file = 'temp.json';
+my $file = catfile($dir, 'temp.json');
{
my $foo = Foo->new(
is($foo->object->number, 2, '... got the right number (in the embedded object)');
}
-unlink $file;
BEGIN {
eval "use Test::YAML::Valid";
plan skip_all => "Test::YAML::Valid is required for this test" if $@;
+ eval "use Best [[qw(YAML::Syck YAML)]]";
+ plan skip_all => "YAML or YAML::syck and Best are required for this test" if $@;
plan tests => 12;
use_ok('MooseX::Storage');
}
use warnings;
use Test::More;
+use File::Temp qw(tempdir);
+use File::Spec::Functions;
+my $dir = tempdir( CLEANUP => 1 );
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 $@;
- plan tests => 21;
+ plan tests => 20;
use_ok('MooseX::Storage');
}
has 'object' => (is => 'ro', isa => 'Object');
}
-my $file = 'temp.json';
+my $file = catfile($dir, 'temp.json');
{
my $foo = Foo->new(
is($foo->object->number, 2, '... got the right number (in the embedded object)');
}
-unlink $file;
-ok(!(-e $file), '... the file has been deleted');
use warnings;
use Test::More;
+use File::Temp qw(tempdir);
+use File::Spec::Functions;
BEGIN {
eval "use JSON::Any";
has 'object' => (is => 'ro', isa => 'Object');
}
-my $file = 'temp.json';
+my $dir = tempdir( CLEANUP => 1 );
+my $file = catfile( $dir, 'temp.json' );
{
my $foo = Foo->new(
is($foo->object->number, 2, '... got the right number (in the embedded object)');
}
-unlink $file;
use warnings;
use Test::More;
+use File::Temp qw(tempdir);
+use File::Spec::Functions;
+my $dir = tempdir( CLEANUP => 1 );
BEGIN {
eval "use IO::AtomicFile";
has 'object' => (is => 'ro', isa => 'Object');
}
-my $file = 'temp.json';
+my $file = catfile($dir,'temp.json');
{
my $foo = Foo->new(
is($foo->object->number, 2, '... got the right number (in the embedded object)');
}
-unlink $file;
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');
has 'object' => (is => 'ro', isa => 'Object');
}
-my $file = 'temp.storable';
+my $file = catfile($dir,'temp.storable');
{
my $foo = Foo->new(
is($foo->object->number, 2, '... got the right number (in the embedded object)');
}
-unlink $file;
use Test::More tests => 11;
use Storable ();
+use File::Temp qw(tempdir);
+use File::Spec::Functions;
+my $dir = tempdir( CLEANUP => 1 );
BEGIN {
use_ok('MooseX::Storage');
}
-my $file = 'temp.storable';
+my $file = catfile($dir,'temp.storable');
{
my $foo = Foo->new(
is($foo->object->number, 2, '... got the right number (in the embedded object)');
}
-unlink $file;
use warnings;
use Test::More;
+use File::Temp qw(tempdir);
+use File::Spec::Functions;
+my $dir = tempdir( CLEANUP => 1 );
BEGIN {
eval "use JSON::Any";
);
}
-my $file = 'temp.json';
+my $file = catfile($dir,'temp.json');
{
my $foo = Foo->new;
'... got the string we expected');
}
-unlink $file;
use warnings;
use Test::More;
+use File::Temp qw(tempdir);
+use File::Spec::Functions;
+my $dir = tempdir( CLEANUP => 1 );
BEGIN {
eval "use IO::AtomicFile";
);
}
-my $file = 'temp.json';
+my $file = catfile($dir, 'temp.json');
{
my $foo = Foo->new;
'... got the string we expected');
}
-unlink $file;