Only load DBICTest::Schema when needed in tests
[dbsrgits/DBIx-Class.git] / t / inflate / datetime_pg.t
index d39496f..d213500 100644 (file)
@@ -2,20 +2,20 @@ use strict;
 use warnings;
 
 use Test::More;
+use Test::Warn;
+use DBIx::Class::Optional::Dependencies ();
 use lib qw(t/lib);
 use DBICTest;
 
 plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_dt_pg')
   unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_dt_pg');
 
-{
-  local $SIG{__WARN__} = sub { warn @_ if $_[0] !~ /extra \=\> .+? has been deprecated/ };
-  DBICTest::Schema->load_classes('EventTZPg');
-}
+require DBICTest::Schema;
+DBICTest::Schema->load_classes('EventTZPg');
 
 my $schema = DBICTest->init_schema();
 
-{
+warnings_are {
   my $event = $schema->resultset("EventTZPg")->find(1);
   $event->update({created_on => '2009-01-15 17:00:00+00'});
   $event->discard_changes;
@@ -33,6 +33,6 @@ my $schema = DBICTest->init_schema();
   is($event->ts_without_tz, $dt, 'timestamp without time zone inflation');
   is($event->ts_without_tz->microsecond, $dt->microsecond,
     'timestamp without time zone microseconds survived');
-}
+} [], 'No warnings during DT manipulations';
 
 done_testing;