X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fstorage%2Fdeploy.t;h=444bf26c173185c75b545ae73558244159efb951;hb=a66b662c77c825952732b8ff4af9d0d1a2ee996d;hp=e6ccd2d9c8d7d19fc0a3e6572638fa2ae10fb1a7;hpb=43d2a76e8e0075cabe98f5a031d26aa97a045736;p=dbsrgits%2FDBIx-Class.git diff --git a/t/storage/deploy.t b/t/storage/deploy.t index e6ccd2d..444bf26 100644 --- a/t/storage/deploy.t +++ b/t/storage/deploy.t @@ -2,6 +2,7 @@ use strict; use warnings; use Test::More; +use Test::Exception; use lib qw(t/lib); use DBICTest; @@ -14,20 +15,24 @@ BEGIN { } use File::Spec; -use File::Path qw/ mkpath rmtree /; +use Path::Class qw/dir/; + +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 = File::Spec->catfile(qw| t var create_ddl_dir |); --d $var - or mkpath($var) - or die "can't create $var"; +my $var = dir ("t/var/ddl_dir-$$"); +$var->mkpath unless -d $var; -my $test_dir_1 = File::Spec->catdir( $var, 'test1', 'foo', 'bar' ); -rmtree( $test_dir_1 ) if -d $test_dir_1; +my $test_dir_1 = $var->subdir ('test1', 'foo', 'bar' ); +$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 mkpath on its target dir' ); +ok( -d $test_dir_1, 'create_ddl_dir did a make_path on its target dir' ); ok( scalar( glob $test_dir_1.'/*.sql' ), 'there are sql files in there' ); TODO: { @@ -35,4 +40,8 @@ TODO: { ok( 0 ); } +END { + $var->rmtree; +} + done_testing;