Allow for tests to run in parallel (simultaneously from multiple checkouts)
[dbsrgits/DBIx-Class.git] / t / storage / deploy.t
index d2bca43..444bf26 100644 (file)
@@ -2,6 +2,7 @@ use strict;
 use warnings;
 
 use Test::More;
+use Test::Exception;
 
 use lib qw(t/lib);
 use DBICTest;
@@ -15,16 +16,20 @@ BEGIN {
 
 use File::Spec;
 use Path::Class qw/dir/;
-use File::Path qw/make_path remove_tree/;
+
+lives_ok( sub {
+    my $parse_schema = DBICTest->init_schema(no_deploy => 1);
+    $parse_schema->deploy({},'t/lib/test_deploy');
+    $parse_schema->resultset("Artist")->all();
+}, 'artist table deployed correctly' );
+
 my $schema = DBICTest->init_schema();
 
-my $var = dir (qw| t var create_ddl_dir |);
--d $var
-    or make_path( "$var" )
-    or die "can't create $var: $!";
+my $var = dir ("t/var/ddl_dir-$$");
+$var->mkpath unless -d $var;
 
 my $test_dir_1 = $var->subdir ('test1', 'foo', 'bar' );
-remove_tree( "$test_dir_1" ) if -d $test_dir_1;
+$test_dir_1->rmtree if -d $test_dir_1;
 $schema->create_ddl_dir( undef, undef, $test_dir_1 );
 
 ok( -d $test_dir_1, 'create_ddl_dir did a make_path on its target dir' );
@@ -35,4 +40,8 @@ TODO: {
     ok( 0 );
 }
 
+END {
+  $var->rmtree;
+}
+
 done_testing;