X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F02-instantiation-wo-component.t;h=f36dbfdc7761de7e4da89a12864354d5da38bf6e;hb=7b3d00f984e43c319a637332579e950376637a3d;hp=bdea8219741204f3a989bfdc35a2f8094b46ae3b;hpb=5761fe02e68a534a47a6a5ff905c73ec991703cd;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git diff --git a/t/02-instantiation-wo-component.t b/t/02-instantiation-wo-component.t index bdea821..f36dbfd 100644 --- a/t/02-instantiation-wo-component.t +++ b/t/02-instantiation-wo-component.t @@ -10,13 +10,12 @@ use aliased 'DBIx::Class::DeploymentHandler', 'DH'; use File::Path 'remove_tree'; use Test::More; +use File::Temp 'tempdir'; use Test::Exception; -DBICDHTest::ready; - -my $db = 'dbi:SQLite:db.db'; -my @connection = ($db, '', '', { ignore_version => 1 }); -my $sql_dir = 't/sql'; +my $dbh = DBICDHTest::dbh(); +my @connection = (sub { $dbh }, { ignore_version => 1 }); +my $sql_dir = tempdir( CLEANUP => 1 ); VERSION1: { use_ok 'DBICVersion_v1'; @@ -40,7 +39,7 @@ VERSION1: { bar => 'frew', }) } 'schema not deployed'; - $handler->install; + $handler->install({ version => 1 }); dies_ok { $handler->install; } 'cannot install twice'; @@ -55,6 +54,20 @@ VERSION2: { use_ok 'DBICVersion_v2'; my $s = DBICVersion::Schema->connect(@connection); $DBICVersion::Schema::VERSION = 2; + subtest 'bug deploying first version' => sub { + my $dbh = DBICDHTest::dbh(); + my @connection = (sub { $dbh }, { ignore_version => 1 }); + my $s = DBICVersion::Schema->connect(@connection); + + my $handler = DH->new({ + script_directory => $sql_dir, + schema => $s, + databases => 'SQLite', + }); + $handler->install({ version => 1 }); + is($handler->database_version, 1, 'correctly set version to 1'); + }; + ok($s, 'DBICVersion::Schema 2 instantiates correctly'); my $handler = DH->new({ script_directory => $sql_dir,