From: Yuval Kogman Date: Wed, 30 Jul 2008 06:29:00 +0000 (+0000) Subject: Test::TempDir X-Git-Tag: v0.900201~74 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9b88036b592cf32ea63a777c8460f5288a35fcb4;p=dbsrgits%2FDBIx-Class-Journal.git Test::TempDir --- diff --git a/Makefile.PL b/Makefile.PL index 31755bf..b9f14fe 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -5,5 +5,6 @@ WriteMakefile( VERSION_FROM => 'lib/DBIx/Class/Schema/Journal.pm', PREREQ_PM => { 'DBIx::Class' => 0.08, 'DBD::SQLite' => 0.12, + 'Test::Tempdir' => 0.04, }, ); diff --git a/t/lib/DBICTest.pm b/t/lib/DBICTest.pm index 2945da9..1725c7e 100644 --- a/t/lib/DBICTest.pm +++ b/t/lib/DBICTest.pm @@ -1,6 +1,8 @@ package # hide from PAUSE DBICTest; +use Test::TempDir; + use strict; use warnings; use DBICTest::Schema; @@ -45,14 +47,7 @@ default, unless the no_deploy or no_populate flags are set. sub init_schema { my $self = shift; my %args = @_; - my $db_file = "t/var/DBIxClass.db"; - my $db_audit = 't/var/Audit.db'; - - unlink($db_file) if -e $db_file; - unlink($db_file . "-journal") if -e $db_file . "-journal"; - unlink($db_audit) if -e $db_audit; - unlink($db_audit . "-journal") if -e $db_audit . "-journal"; - mkdir("t/var") unless -d "t/var"; + my $db_file = temp_root->file("main.db"); my $dsn = $ENV{"DBICTEST_DSN"} || "dbi:SQLite:${db_file}"; my $dbuser = $ENV{"DBICTEST_DBUSER"} || ''; diff --git a/t/lib/DBICTest/Schema.pm b/t/lib/DBICTest/Schema.pm index 3e58f95..ff49a97 100644 --- a/t/lib/DBICTest/Schema.pm +++ b/t/lib/DBICTest/Schema.pm @@ -5,8 +5,6 @@ use base qw/DBIx::Class::Schema/; __PACKAGE__->load_components(qw/+DBIx::Class::Schema::Journal/); -__PACKAGE__->journal_connection(['dbi:SQLite:t/var/Audit.db']); - no warnings qw/qw/; DBICTest::Schema->load_classes( qw/