Remove all uses of Scope::Guard from the tests, use our own version
[dbsrgits/DBIx-Class.git] / t / icdt / engine_specific / firebird.t
index 207df9f..05ef381 100644 (file)
@@ -1,12 +1,12 @@
-use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_dt';
+use DBIx::Class::Optional::Dependencies -skip_all_without => qw( ic_dt _rdbms_firebird_common );
 
 use strict;
 use warnings;
 
 use Test::More;
+use DBIx::Class::_Util 'scope_guard';
 use lib qw(t/lib);
 use DBICTest;
-use Scope::Guard ();
 
 my $env2optdep = {
   DBICTEST_FIREBIRD => 'test_rdbms_firebird',
@@ -14,13 +14,14 @@ my $env2optdep = {
   DBICTEST_FIREBIRD_ODBC => 'test_rdbms_firebird_odbc',
 };
 
-plan skip_all => join (' ',
-  'Set $ENV{DBICTEST_FIREBIRD_DSN} and/or $ENV{DBICTEST_FIREBIRD_INTERBASE_DSN}',
-  'and/or $ENV{DBICTEST_FIREBIRD_ODBC_DSN},',
-  '_USER and _PASS to run these tests.',
-
-  "WARNING: This test drops and creates a table called 'event'",
-) unless grep { $ENV{"${_}_DSN"} } keys %$env2optdep;
+my @tdeps = values %$env2optdep;
+plan skip_all => 'Test needs  ' . (join '  OR  ', map
+  { "[ @{[ DBIx::Class::Optional::Dependencies->req_missing_for( $_ ) ]} ]" }
+  @tdeps
+) unless scalar grep
+  { DBIx::Class::Optional::Dependencies->req_ok_for( $_ ) }
+  @tdeps
+;
 
 my $schema;
 
@@ -41,7 +42,7 @@ for my $prefix (keys %$env2optdep) { SKIP: {
     on_connect_call => [ 'datetime_setup' ],
   });
 
-  my $sg = Scope::Guard->new(sub { cleanup($schema) } );
+  my $sg = scope_guard { cleanup($schema) };
 
   eval { $schema->storage->dbh->do('DROP TABLE "event"') };
   $schema->storage->dbh->do(<<'SQL');