From: Samuel Kaufman Date: Tue, 30 Dec 2014 19:45:19 +0000 (+0000) Subject: made tests cross os compatible X-Git-Tag: v1.001027_02~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=66d02e2452b300d1e02ff3d7e855c7a8382b9232;p=dbsrgits%2FDBIx-Class-Fixtures.git made tests cross os compatible --- diff --git a/Changes b/Changes index b6c8f5d..cf0cf87 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,8 @@ Revision history for DBIx-Class-Fixtures {{$NEXT}} +- Tests look good ( except still busted on windows ), releasing as stable + 1.001027_01 2014-12-26 17:06:08+00:00 Europe/London - Fix fixture filenames to be compatible with ntfs systems - mrf++ diff --git a/t/01-new.t b/t/01-new.t index b880c76..685a80b 100644 --- a/t/01-new.t +++ b/t/01-new.t @@ -2,9 +2,10 @@ use DBIx::Class::Fixtures; use Test::More tests => 3; +use IO::All; -my $config_dir = 't/var/configs'; -my $imaginary_config_dir = 't/var/not_there'; +my $config_dir = io->catfile(qw't var configs')->name; +my $imaginary_config_dir = io->catfile(qw't var not_there')->name; eval { DBIx::Class::Fixtures->new({ }); diff --git a/t/02-dump-basic.t b/t/02-dump-basic.t index 62a156e..e60ccb5 100644 --- a/t/02-dump-basic.t +++ b/t/02-dump-basic.t @@ -6,20 +6,21 @@ use lib qw(t/lib); use DBICTest; use Path::Class; use Data::Dumper; +use IO::All; # set up and populate schema ok(my $schema = DBICTest->init_schema(), 'got schema'); -my $config_dir = 't/var/configs'; +my $config_dir = io->catfile(qw't var configs')->name; { # do dump ok(my $fixtures = DBIx::Class::Fixtures->new({ config_dir => $config_dir, debug => 0 }), 'object created with correct config dir'); - ok($fixtures->dump({ config => 'simple.json', schema => $schema, directory => 't/var/fixtures' }), 'simple dump executed okay'); + ok($fixtures->dump({ config => 'simple.json', schema => $schema, directory => io->catfile(qw't var fixtures')->name }), 'simple dump executed okay'); # check dump is okay - my $dir = dir('t/var/fixtures/artist'); - ok(-e 't/var/fixtures/artist', 'artist directory created'); + my $dir = dir(io->catfile(qw't var fixtures artist')->name); + ok(-e io->catfile(qw't var fixtures artist')->name, 'artist directory created'); my @children = $dir->children; is(scalar(@children), 1, 'right number of fixtures created'); @@ -54,12 +55,12 @@ my $config_dir = 't/var/configs'; }] }, schema => $schema, - directory => 't/var/fixtures', + directory => io->catfile(qw't var fixtures')->name, }), 'simple dump executed okay'); # check dump is okay - my $dir = dir('t/var/fixtures/artist'); - ok(-e 't/var/fixtures/artist', 'artist directory created'); + my $dir = dir(io->catfile(qw't var fixtures artist')->name); + ok(-e io->catfile(qw't var fixtures artist')->name, 'artist directory created'); my @children = $dir->children; is(scalar(@children), 1, 'right number of fixtures created'); diff --git a/t/03-dump-quantity.t b/t/03-dump-quantity.t index 2414697..5fba55b 100644 --- a/t/03-dump-quantity.t +++ b/t/03-dump-quantity.t @@ -6,18 +6,18 @@ use lib qw(t/lib); use DBICTest; use Path::Class; use Data::Dumper; - +use IO::All; # set up and populate schema ok(my $schema = DBICTest->init_schema(), 'got schema'); -my $config_dir = 't/var/configs'; +my $config_dir = io->catfile(qw't var configs')->name; # do dump ok(my $fixtures = DBIx::Class::Fixtures->new({ config_dir => $config_dir, debug => 0 }), 'object created with correct config dir'); -ok($fixtures->dump({ config => 'quantity.json', schema => $schema, directory => 't/var/fixtures' }), 'quantity dump executed okay'); +ok($fixtures->dump({ config => 'quantity.json', schema => $schema, directory => io->catfile(qw't var fixtures')->name }), 'quantity dump executed okay'); # check dump is okay -my $dir = dir('t/var/fixtures/CD'); +my $dir = dir(io->catfile(qw't var fixtures CD')->name); my @children = $dir->children; is(scalar(@children), 3, 'right number of cd fixtures created'); diff --git a/t/04-dump-fetch.t b/t/04-dump-fetch.t index bb99e40..0c21c60 100644 --- a/t/04-dump-fetch.t +++ b/t/04-dump-fetch.t @@ -6,18 +6,19 @@ use lib qw(t/lib); use DBICTest; use Path::Class; use Data::Dumper; +use IO::All; # set up and populate schema ok(my $schema = DBICTest->init_schema(), 'got schema'); -my $config_dir = 't/var/configs'; +my $config_dir = io->catfile(qw't var configs')->name; # do dump ok(my $fixtures = DBIx::Class::Fixtures->new({ config_dir => $config_dir, debug => 0 }), 'object created with correct config dir'); -ok($fixtures->dump({ config => 'fetch.json', schema => $schema, directory => 't/var/fixtures' }), 'fetch dump executed okay'); +ok($fixtures->dump({ config => 'fetch.json', schema => $schema, directory => io->catfile(qw't var fixtures')->name }), 'fetch dump executed okay'); # check dump is okay -my $dir = dir('t/var/fixtures/artist'); +my $dir = dir(io->catfile(qw't var fixtures artist')->name); my @children = $dir->children; is(scalar(@children), 3, 'right number of artist fixtures created'); @@ -31,7 +32,7 @@ foreach my $id (1, 2) { my $artist1 = $schema->resultset('Artist')->find(1); my @artist1_cds = $artist1->cds->all; foreach my $cd (@artist1_cds) { - my $cd_fix_file = dir('t/var/fixtures', 'CD', $cd->id . '.fix'); + my $cd_fix_file = dir(io->catfile(qw't var fixtures')->name, 'CD', $cd->id . '.fix'); ok(-e $cd_fix_file, "artist1's cd rel dumped okay"); } @@ -39,11 +40,11 @@ foreach my $cd (@artist1_cds) { my $artist2 = $schema->resultset('Artist')->find(2); my @artist2_cds = $artist2->cds->search({ year => { '>' => 2002 } }); foreach my $cd (@artist2_cds) { - my $cd_fix_file = dir('t/var/fixtures', 'CD', $cd->id . '.fix'); + my $cd_fix_file = dir(io->catfile(qw't var fixtures')->name, 'CD', $cd->id . '.fix'); ok(-e $cd_fix_file, "artist2's cd rel dumped okay"); } -my $cd_dir = dir('t/var/fixtures/CD'); +my $cd_dir = dir(io->catfile(qw't var fixtures CD')->name); @children = $cd_dir->children; is(scalar(@children), scalar(@artist1_cds) + scalar(@artist2_cds), 'no extra cd fixtures dumped'); diff --git a/t/05-dump-rules.t b/t/05-dump-rules.t index f6a085f..4b74df5 100644 --- a/t/05-dump-rules.t +++ b/t/05-dump-rules.t @@ -6,18 +6,19 @@ use lib qw(t/lib); use DBICTest; use Path::Class; use Data::Dumper; +use IO::All; # set up and populate schema ok(my $schema = DBICTest->init_schema(), 'got schema'); -my $config_dir = 't/var/configs'; +my $config_dir = io->catfile(qw't var configs')->name; # do dump ok(my $fixtures = DBIx::Class::Fixtures->new({ config_dir => $config_dir, debug => 0 }), 'object created with correct config dir'); -ok($fixtures->dump({ config => 'rules.json', schema => $schema, directory => 't/var/fixtures' }), 'fetch dump executed okay'); +ok($fixtures->dump({ config => 'rules.json', schema => $schema, directory => io->catfile(qw't var fixtures')->name }), 'fetch dump executed okay'); # check dump is okay -my $dir = dir('t/var/fixtures'); +my $dir = dir(io->catfile(qw't var fixtures')->name); my $cd_dir = dir($dir, 'CD'); my $track_dir = dir($dir, 'track'); diff --git a/t/06-dump-date.t b/t/06-dump-date.t index efff2e4..63f47b7 100644 --- a/t/06-dump-date.t +++ b/t/06-dump-date.t @@ -16,12 +16,12 @@ plan tests => 5; # set up and populate schema ok(my $schema = DBICTest->init_schema( dsn => $ENV{FIXTURETEST_DSN}, user => $ENV{FIXTURETEST_USER}, pass => $ENV{FIXTURETEST_PASS}), 'got schema'); -my $config_dir = 't/var/configs'; +my $config_dir = io->catfile(qw't var configs')->name; # do dump ok(my $fixtures = DBIx::Class::Fixtures->new({ config_dir => $config_dir, debug => 0 }), 'object created with correct config dir'); -ok($fixtures->dump({ config => 'date.json', schema => $schema, directory => 't/var/fixtures' }), 'date dump executed okay'); -ok($fixtures->populate({ ddl => DBICTest->get_ddl_file($schema), connection_details => [$ENV{FIXTURETEST_DSN}, $ENV{FIXTURETEST_USER} || '', $ENV{FIXTURETEST_PASS} || ''], directory => 't/var/fixtures' }), 'date populate okay'); +ok($fixtures->dump({ config => 'date.json', schema => $schema, directory => io->catfile(qw't var fixtures')->name }), 'date dump executed okay'); +ok($fixtures->populate({ ddl => DBICTest->get_ddl_file($schema), connection_details => [$ENV{FIXTURETEST_DSN}, $ENV{FIXTURETEST_USER} || '', $ENV{FIXTURETEST_PASS} || ''], directory => io->catfile(qw't var fixtures')->name }), 'date populate okay'); my $track = $schema->resultset('Track')->find(9); my $now = DateTime->now(); diff --git a/t/07-dump-all.t b/t/07-dump-all.t index 5d5caa9..08fc286 100644 --- a/t/07-dump-all.t +++ b/t/07-dump-all.t @@ -6,14 +6,14 @@ use lib qw(t/lib); use DBICTest; use Path::Class; use Data::Dumper; - +use IO::All; plan tests => 16; # set up and populate schema ok(my $schema = DBICTest->init_schema( ), 'got schema'); -my $config_dir = 't/var/configs'; -my $fixture_dir = 't/var/fixtures'; +my $config_dir = io->catfile(qw't var configs')->name; +my $fixture_dir = io->catfile(qw't var fixtures')->name; # do dump { @@ -31,12 +31,22 @@ my $fixture_dir = 't/var/fixtures'; # do dump with excludes { ok(my $fixtures = DBIx::Class::Fixtures->new({ config_dir => $config_dir, debug => 0 }), 'object created with correct config dir'); - ok($fixtures->dump({ all => 1, schema => $schema, excludes => ['Tag'], directory => "$fixture_dir/excludes" }), 'fetch dump executed okay'); + ok( + $fixtures->dump( + { + all => 1, + schema => $schema, + excludes => ['Tag'], + directory => io->catfile( $fixture_dir, 'excludes' )->name + } + ), + 'fetch dump executed okay' + ); foreach my $source ($schema->sources) { my $rs = $schema->resultset($source); next if $rs->result_source->from eq 'tags'; - my $dir = dir("$fixture_dir/excludes", ref $rs->result_source->name ? $rs->result_source->source_name : $rs->result_source->name); + my $dir = dir(io->catfile($fixture_dir,"excludes")->name, ref $rs->result_source->name ? $rs->result_source->source_name : $rs->result_source->name); my @children = $dir->children; is (scalar(@children), $rs->count, 'all objects from $source dumped'); } diff --git a/t/08-dump-includes.t b/t/08-dump-includes.t index 2c683b9..169699c 100644 --- a/t/08-dump-includes.t +++ b/t/08-dump-includes.t @@ -6,24 +6,25 @@ use lib qw(t/lib); use DBICTest; use Path::Class; use Data::Dumper; +use IO::All; # set up and populate schema ok(my $schema = DBICTest->init_schema(), 'got schema'); -my $config_dir = 't/var/configs'; +my $config_dir = io->catfile(qw't var configs')->name; # do dump ok(my $fixtures = DBIx::Class::Fixtures->new({ config_dir => $config_dir, debug => 0 }), 'object created with correct config dir'); -ok($fixtures->dump({ config => 'includes.json', schema => $schema, directory => 't/var/fixtures' }), 'simple dump executed okay'); +ok($fixtures->dump({ config => 'includes.json', schema => $schema, directory => io->catfile(qw't var fixtures')->name }), 'simple dump executed okay'); # check dump is okay -my $producer_dir = dir('t/var/fixtures/producer'); +my $producer_dir = dir(io->catfile(qw't var fixtures producer')->name); ok(-e $producer_dir, 'producer directory created'); my @producer_children = $producer_dir->children; is(scalar(@producer_children), 1, 'right number of fixtures created'); -my $artist_dir = dir('t/var/fixtures/artist'); +my $artist_dir = dir(io->catfile(qw't var fixtures artist')->name); ok(-e $artist_dir, 'artist directory created'); my @artist_children = $artist_dir->children; diff --git a/t/09-dump-scalar-ref.t b/t/09-dump-scalar-ref.t index d7fa019..f540133 100644 --- a/t/09-dump-scalar-ref.t +++ b/t/09-dump-scalar-ref.t @@ -6,20 +6,21 @@ use lib qw(t/lib); use DBICTest; use Path::Class; use Data::Dumper; +use IO::All; # set up and populate schema ok(my $schema = DBICTest->init_schema(), 'got schema'); -my $config_dir = 't/var/configs'; +my $config_dir = io->catfile(qw't var configs')->name; # do dump ok(my $fixtures = DBIx::Class::Fixtures->new({ config_dir => $config_dir, debug => 0 }), 'object created with correct config dir'); -ok($fixtures->dump({ config => 'scalar_ref.json', schema => $schema, directory => 't/var/fixtures' }), 'simple dump executed okay'); +ok($fixtures->dump({ config => 'scalar_ref.json', schema => $schema, directory => io->catfile(qw't var fixtures')->name }), 'simple dump executed okay'); { # check dump is okay - my $dir = dir('t/var/fixtures/artist'); + my $dir = dir(io->catfile(qw't var fixtures artist')->name); my @children = $dir->children; is(scalar(@children), 1, 'right number of fixtures created'); @@ -31,7 +32,7 @@ ok($fixtures->dump({ config => 'scalar_ref.json', schema => $schema, directory = { # check dump is okay - my $dir = dir('t/var/fixtures/CD'); + my $dir = dir(io->catfile(qw't var fixtures CD')->name); my @children = $dir->children; is(scalar(@children), 1, 'right number of fixtures created'); diff --git a/t/10-dump-cleanup.t b/t/10-dump-cleanup.t index 2febc75..5cbf9b7 100644 --- a/t/10-dump-cleanup.t +++ b/t/10-dump-cleanup.t @@ -6,22 +6,23 @@ use lib qw(t/lib); use DBICTest; use Path::Class; use Data::Dumper; +use IO::All; # set up and populate schema ok(my $schema = DBICTest->init_schema(), 'got schema'); -my $config_dir = 't/var/configs'; +my $config_dir = io->catfile(qw't var configs')->name; # do dump ok(my $fixtures = DBIx::Class::Fixtures->new({ config_dir => $config_dir }), 'object created with correct config dir'); -my $output_dir = dir('t/var/fixtures'); +my $output_dir = dir(io->catfile(qw't var fixtures')->name); $output_dir->mkpath; my $file = file($output_dir, 'test_file'); my $fh = $file->open('w'); print $fh 'test file'; $fh->close; -ok($fixtures->dump({ config => 'simple.json', schema => $schema, directory => 't/var/fixtures' }), 'simple dump executed okay'); +ok($fixtures->dump({ config => 'simple.json', schema => $schema, directory => io->catfile(qw't var fixtures')->name }), 'simple dump executed okay'); ok(-e $file, 'file still exists'); diff --git a/t/12-populate-basic.t b/t/12-populate-basic.t index 35ff4d2..66bdc6d 100644 --- a/t/12-populate-basic.t +++ b/t/12-populate-basic.t @@ -6,10 +6,11 @@ use lib qw(t/lib); use DBICTest; use Path::Class; use Data::Dumper; +use IO::All; # set up and populate schema ok(my $schema = DBICTest->init_schema(), 'got schema'); -my $config_dir = 't/var/configs'; +my $config_dir = io->catfile(qw't var configs')->name; # do dump ok(my $fixtures = DBIx::Class::Fixtures->new({ @@ -25,18 +26,18 @@ foreach my $set ('simple', 'quantity', 'fetch', 'rules') { ok($fixtures->dump({ config => "$set.json", schema => $schema, - directory => 't/var/fixtures' + directory => io->catfile(qw't var fixtures')->name }), "$set dump executed okay" ); $fixtures->populate({ - ddl => 't/lib/sqlite.sql', - connection_details => ['dbi:SQLite:t/var/DBIxClass.db', '', ''], - directory => 't/var/fixtures' + ddl => io->catfile(qw[t lib sqlite.sql])->name, + connection_details => ['dbi:SQLite:'.io->catfile(qw[ t var DBIxClass.db ])->name, '', ''], + directory => io->catfile(qw't var fixtures')->name }); $schema = DBICTest->init_schema( no_deploy => 1); - my $fixture_dir = dir('t/var/fixtures'); + my $fixture_dir = dir(io->catfile(qw't var fixtures')->name); foreach my $class ($schema->sources) { my $source_dir = dir($fixture_dir, lc($class)); is($schema->resultset($class)->count, @@ -68,13 +69,13 @@ $fixtures = DBIx::Class::Fixtures->new({ ok( $fixtures->dump({ config => "use_create.json", schema => $schema, - directory => 't/var/fixtures' + directory => io->catfile(qw't var fixtures')->name }), "use_create dump executed okay" ); $schema = DBICTest->init_schema( no_populate => 1 ); $fixtures->populate({ - directory => 't/var/fixtures', - connection_details => ['dbi:SQLite:t/var/DBIxClass.db', '', ''], + directory => io->catfile(qw't var fixtures')->name, + connection_details => ['dbi:SQLite:'.io->catfile(qw[ t var DBIxClass.db ])->name, '', ''], schema => $schema, no_deploy => 1, use_create => 1 @@ -84,16 +85,16 @@ is( $schema->resultset( "Artist" )->find({ artistid => 4 })->name, "Test Name", $schema = DBICTest->init_schema( no_populate => 1 ); $fixtures->populate({ - directory => 't/var/fixtures', - connection_details => ['dbi:SQLite:t/var/DBIxClass.db', '', ''], + directory => io->catfile(qw't var fixtures')->name, + connection_details => ['dbi:SQLite:'.io->catfile(qw[ t var DBIxClass.db ])->name, '', ''], schema => $schema, no_deploy => 1, use_find_or_create => 1 }); is( $schema->resultset( "Artist" )->find({ artistid => 4 })->name, "Test Name", "use_find_or_create => 1 ok" ); $fixtures->populate({ - directory => 't/var/fixtures', - connection_details => ['dbi:SQLite:t/var/DBIxClass.db', '', ''], + directory => io->catfile(qw't var fixtures')->name, + connection_details => ['dbi:SQLite:'.io->catfile(qw[ t var DBIxClass.db ])->name, '', ''], schema => $schema, no_deploy => 1, use_find_or_create => 1 diff --git a/t/13-populate-two-dbs.t b/t/13-populate-two-dbs.t index 30a0318..af917ab 100644 --- a/t/13-populate-two-dbs.t +++ b/t/13-populate-two-dbs.t @@ -8,12 +8,14 @@ use Path::Class; use Data::Dumper; use DBICTest::Schema2; +use IO::All; + # set up and populate normal schema ok(my $schema = DBICTest->init_schema(), 'got schema'); -my $config_dir = 't/var/configs'; - +my $config_dir = io->catfile(qw't var configs')->name; +my $dbix_class_different = io->catfile(qw[ t var DBIxClassDifferent.db ])->name; my @different_connection_details = ( - 'dbi:SQLite:t/var/DBIxClassDifferent.db', + "dbi:SQLite:$dbix_class_different", '', '' ) @@ -23,9 +25,9 @@ my $schema2 = DBICTest::Schema2->compose_namespace('DBICTest2') ok $schema2; -unlink('t/var/DBIxClassDifferent.db') if (-e 't/var/DBIxClassDifferent.db'); +unlink($dbix_class_different) if (-e $dbix_class_different ); -DBICTest->deploy_schema($schema2, 't/lib/sqlite_different.sql'); +DBICTest->deploy_schema($schema2, 't lib sqlite_different.sql'); # do dump ok(my $fixtures = DBIx::Class::Fixtures->new({ @@ -37,21 +39,21 @@ ok(my $fixtures = DBIx::Class::Fixtures->new({ ok($fixtures->dump({ config => "simple.json", schema => $schema, - directory => 't/var/fixtures' + directory => io->catfile(qw't var fixtures')->name }), "simple dump executed okay"); ok($fixtures->populate({ - ddl => 't/lib/sqlite_different.sql', + ddl => io->catfile(qw[t lib sqlite_different.sql])->name, connection_details => [@different_connection_details], - directory => 't/var/fixtures' + directory => io->catfile(qw't var fixtures')->name }), 'mysql populate okay'); ok($fixtures->populate({ - ddl => 't/lib/sqlite.sql', - connection_details => ['dbi:SQLite:t/var/DBIxClass.db', '', ''], - directory => 't/var/fixtures' + ddl => io->catfile(qw[ t lib sqlite.sql ])->name, + connection_details => ['dbi:SQLite:'.io->catfile(qw[ t var DBIxClass.db ])->name, '', ''], + directory => io->catfile(qw't var fixtures')->name }), 'sqlite populate okay'); diff --git a/t/14-populate-post.t b/t/14-populate-post.t index a42b542..9bf6329 100644 --- a/t/14-populate-post.t +++ b/t/14-populate-post.t @@ -6,10 +6,11 @@ use lib qw(t/lib); use DBICTest; use Path::Class; use Data::Dumper; +use IO::All; # set up and populate schema ok(my $schema = DBICTest->init_schema(), 'got schema'); -my $config_dir = 't/var/configs'; +my $config_dir = io->catfile(qw't var configs')->name; # do dump ok(my $fixtures = DBIx::Class::Fixtures->new({ @@ -20,15 +21,15 @@ ok(my $fixtures = DBIx::Class::Fixtures->new({ ok($fixtures->dump({ config => "simple.json", schema => $schema, - directory => 't/var/fixtures' + directory => io->catfile(qw't var fixtures' )->name }), "simple dump executed okay"); $fixtures->populate({ - ddl => 't/lib/sqlite.sql', - connection_details => ['dbi:SQLite:t/var/DBIxClass.db', '', ''], - directory => 't/var/fixtures', - post_ddl => 't/lib/post_sqlite.sql' + ddl => io->catfile(qw't lib sqlite.sql')->name, + connection_details => ['dbi:SQLite:'.io->catfile(qw't var DBIxClass.db')->name, '', ''], + directory => io->catfile(qw't var fixtures')->name, + post_ddl => io->catfile(qw't lib post_sqlite.sql')->name }); $schema = DBICTest->init_schema(no_deploy => 1); diff --git a/t/15-multiple-belongs-to.t b/t/15-multiple-belongs-to.t index 803e600..dea986f 100644 --- a/t/15-multiple-belongs-to.t +++ b/t/15-multiple-belongs-to.t @@ -6,23 +6,24 @@ use lib qw(t/lib); use DBICTest; use Path::Class; use Data::Dumper; +use IO::All; # set up and populate schema ok(my $schema = DBICTest->init_schema(), 'got schema'); -my $config_dir = 't/var/configs'; +my $config_dir = io->catfile(qw't var configs')->name; # do dump ok(my $fixtures = DBIx::Class::Fixtures->new({ config_dir => $config_dir, debug => 0 }), 'object created with correct config dir'); -ok($fixtures->dump({ config => 'multiple-has-many.json', schema => $schema, directory => 't/var/fixtures' }), 'fetch dump executed okay'); +ok($fixtures->dump({ config => 'multiple-has-many.json', schema => $schema, directory => io->catfile(qw't var fixtures')->name }), 'fetch dump executed okay'); # check dump is okay -my $dir = dir('t/var/fixtures'); +my $dir = dir(io->catfile(qw't var fixtures')->name); -ok( -e 't/var/fixtures/producer', "We fetched some producers" ); -ok( -e 't/var/fixtures/cd_to_producer', "We fetched some cd/producer xrefs" ); -ok( -e 't/var/fixtures/CD', "We fetched some cds" ); -ok( -e 't/var/fixtures/artist', "We fetched some artists" ); +ok( -e io->catfile(qw't var fixtures producer')->name, "We fetched some producers" ); +ok( -e io->catfile(qw't var fixtures cd_to_producer')->name, "We fetched some cd producer xrefs" ); +ok( -e io->catfile(qw't var fixtures CD')->name, "We fetched some cds" ); +ok( -e io->catfile(qw't var fixtures artist')->name, "We fetched some artists" ); __END__ while ( my ($dirname, $sourcename) = each %dirs ) { diff --git a/t/16-rules-hasmany.t b/t/16-rules-hasmany.t index ba1f3df..82bf1d1 100644 --- a/t/16-rules-hasmany.t +++ b/t/16-rules-hasmany.t @@ -6,15 +6,16 @@ use lib qw(t/lib); use DBICTest; use Path::Class; use Data::Dumper; +use IO::All; # set up and populate schema ok(my $schema = DBICTest->init_schema(), 'got schema'); -my $config_dir = 't/var/configs'; +my $config_dir = io->catfile(qw't var configs')->name; # do dump ok(my $fixtures = DBIx::Class::Fixtures->new({ config_dir => $config_dir, debug => 0 }), 'object created with correct config dir'); -ok($fixtures->dump({ config => 'rules2.json', schema => $schema, directory => 't/var/fixtures' }), 'quantity dump executed okay'); +ok($fixtures->dump({ config => 'rules2.json', schema => $schema, directory => io->catfile(qw't var fixtures')->name }), 'quantity dump executed okay'); # check dump is okay foreach my $test ( @@ -22,7 +23,7 @@ foreach my $test ( [ 'CD', 2, 'CD', 'cdid' ], ) { my ($dirname, $count, $moniker, $id) = @$test; - my $dir = dir("t/var/fixtures/$dirname"); + my $dir = dir(io->catfile(qw"t var fixtures",$dirname)->name); my @children = $dir->children; is(scalar(@children), $count, "right number of $dirname fixtures created"); diff --git a/t/17-dump_all_config_sets.t b/t/17-dump_all_config_sets.t index 96d03da..be33234 100644 --- a/t/17-dump_all_config_sets.t +++ b/t/17-dump_all_config_sets.t @@ -6,15 +6,16 @@ use DBICTest; use Path::Class; use Data::Dumper; use File::Spec; +use IO::All; -ok my $config_dir = 't/var/configs'; +ok my $config_dir = io->catfile(qw't var configs')->name; ok my $schema = DBICTest->init_schema(), 'got schema'; ok my $fixtures = DBIx::Class::Fixtures->new({config_dir => $config_dir}), 'object created with correct config dir'; my $ret = $fixtures->dump_config_sets({ - configs => [qw/date.json rules.json/], + configs => [qw[ date.json rules.json ]], schema => $schema, directory_template => sub { my ($fixture, $params, $set) = @_; @@ -22,10 +23,10 @@ my $ret = $fixtures->dump_config_sets({ }, }); -ok -e 't/var/fixtures/multi/date.json/artist', +ok -e io->catfile(qw't var fixtures multi date.json artist')->name, 'artist directory created'; -my $dir = dir('t/var/fixtures/multi/date.json/artist'); +my $dir = dir(io->catfile(qw't var fixtures multi date.json artist')->name); my @children = $dir->children; is(scalar(@children), 1, 'right number of fixtures created'); diff --git a/t/18-extra.t b/t/18-extra.t index fc20aaa..90006e8 100644 --- a/t/18-extra.t +++ b/t/18-extra.t @@ -4,11 +4,12 @@ use File::Path 'rmtree'; use lib qw(t/lib); use ExtraTest::Schema; +use IO::All; (my $schema = ExtraTest::Schema->connect( 'DBI:SQLite::memory:','',''))->init_schema; -open(my $fh, '<', 't/18-extra.t') || +open(my $fh, '<', io->catfile(qw't 18-extra.t')->name) || die "Can't open the filehandle, test is trash!"; ok my $row = $schema @@ -22,15 +23,15 @@ close($fh); my $fixtures = DBIx::Class::Fixtures ->new({ - config_dir => 't/var/configs', - config_attrs => { photo_dir => './t/var/files' }, + config_dir => io->catfile(qw't var configs')->name, + config_attrs => { photo_dir => io->catfile(qw't var files')->name }, debug => 0 }); ok( $fixtures->dump({ config => 'extra.json', schema => $schema, - directory => "t/var/fixtures/photos" }), + directory => io->catfile(qw"t var fixtures photos")->name }), 'fetch dump executed okay'); ok my $key = $schema->resultset('Photo')->first->file; @@ -45,7 +46,7 @@ ok( $fixtures->populate({ no_deploy => 1, schema => $schema, - directory => "t/var/fixtures/photos"}), + directory => io->catfile(qw"t var fixtures photos")->name}), 'populated'); is $key, $schema->resultset('Photo')->first->file, @@ -56,6 +57,6 @@ ok -e $key, 'File Restored'; done_testing; END { - rmtree 't/var/files'; - rmtree 't/var/fixtures/photos'; + rmtree io->catfile(qw't var files')->name; + rmtree io->catfile(qw't var fixtures photos')->name; }