Cleanup/improve the leaktest a bit
[dbsrgits/DBIx-Class-Historic.git] / t / storage / deploy.t
CommitLineData
4068e05f 1use strict;
2use warnings;
3
4use Test::More;
91d0c99f 5use Test::Exception;
4068e05f 6
7use lib qw(t/lib);
8use DBICTest;
9
43d2a76e 10BEGIN {
11 require DBIx::Class;
12 plan skip_all =>
13 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('deploy')
14 unless DBIx::Class::Optional::Dependencies->req_ok_for ('deploy')
15}
16
4068e05f 17use File::Spec;
076be7c4 18use Path::Class qw/dir/;
19use File::Path qw/make_path remove_tree/;
91d0c99f 20
21lives_ok( sub {
22 my $parse_schema = DBICTest->init_schema(no_deploy => 1);
23 $parse_schema->deploy({},'t/lib/test_deploy');
24 $parse_schema->resultset("Artist")->all();
25}, 'artist table deployed correctly' );
26
4068e05f 27my $schema = DBICTest->init_schema();
28
076be7c4 29my $var = dir (qw| t var create_ddl_dir |);
4068e05f 30-d $var
076be7c4 31 or make_path( "$var" )
32 or die "can't create $var: $!";
4068e05f 33
076be7c4 34my $test_dir_1 = $var->subdir ('test1', 'foo', 'bar' );
35remove_tree( "$test_dir_1" ) if -d $test_dir_1;
4068e05f 36$schema->create_ddl_dir( undef, undef, $test_dir_1 );
37
076be7c4 38ok( -d $test_dir_1, 'create_ddl_dir did a make_path on its target dir' );
4068e05f 39ok( scalar( glob $test_dir_1.'/*.sql' ), 'there are sql files in there' );
40
41TODO: {
42 local $TODO = 'we should probably add some tests here for actual deployability of the DDL?';
43 ok( 0 );
44}
45
46done_testing;