switch tests to Test::TempDir::Tiny to enable parallelization
[dbsrgits/DBIx-Class-Fixtures.git] / t / 10-dump-cleanup.t
CommitLineData
da25ed7c 1#!perl
2
3use DBIx::Class::Fixtures;
4use Test::More tests => 4;
5use lib qw(t/lib);
6use DBICTest;
7use Path::Class;
8use Data::Dumper;
01a3246a 9use Test::TempDir::Tiny;
66d02e24 10use IO::All;
da25ed7c 11
01a3246a 12my $tempdir = tempdir;
13
da25ed7c 14# set up and populate schema
01a3246a 15ok(my $schema = DBICTest->init_schema(db_dir => $tempdir), 'got schema');
da25ed7c 16
66d02e24 17my $config_dir = io->catfile(qw't var configs')->name;
da25ed7c 18
19# do dump
20ok(my $fixtures = DBIx::Class::Fixtures->new({ config_dir => $config_dir }), 'object created with correct config dir');
21
01a3246a 22my $output_dir = dir($tempdir);
da25ed7c 23$output_dir->mkpath;
24my $file = file($output_dir, 'test_file');
25my $fh = $file->open('w');
26print $fh 'test file';
27$fh->close;
28
01a3246a 29ok($fixtures->dump({ config => 'simple.json', schema => $schema, directory => $tempdir }), 'simple dump executed okay');
da25ed7c 30
31ok(-e $file, 'file still exists');