Resolve $rsrc instance duality on metadata traversal
[dbsrgits/DBIx-Class.git] / t / cdbi / 04-lazy.t
index 1ca4165..96d5743 100644 (file)
@@ -1,5 +1,9 @@
+BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
+use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
+
 use strict;
 use warnings;
+
 use Test::More;
 use Test::Warn;
 
@@ -7,18 +11,8 @@ use Test::Warn;
 # Test lazy loading
 #----------------------------------------------------------------------
 
-BEGIN {
-  eval "use DBIx::Class::CDBICompat;";
-  plan $@
-    ? (skip_all => 'Class::Trigger and DBIx::ContextualFetch required')
-    : (tests => 36)
-  ;
-}
-
-INIT {
-  use lib 't/cdbi/testlib';
-  use Lazy;
-}
+use lib 't/cdbi/testlib';
+use Lazy;
 
 is_deeply [ Lazy->columns('Primary') ],        [qw/this/],      "Pri";
 is_deeply [ sort Lazy->columns('Essential') ], [qw/opop this/], "Essential";
@@ -117,7 +111,7 @@ warning_like {
 
 # Now again for inflated values
 SKIP: {
-    skip "Requires Date::Simple 3.03", 5 unless eval "use Date::Simple 3.03; 1; ";
+    DBIx::Class::Optional::Dependencies->skip_without( 'Date::Simple>=3.03' );
     Lazy->has_a(
         orp     => 'Date::Simple',
         inflate => sub { Date::Simple->new($_[0] . '-01-01') },
@@ -179,3 +173,5 @@ SKIP: {
     # I'm too lazy to set up the proper inflation test.
     ok !exists $l->{_column_data}{orp};
 }
+
+done_testing;