0.03006 - fix columns_info_for interaction
[dbsrgits/DBIx-Class-Schema-Loader.git] / t / 22dump.t
index 54193d9..5d32c90 100644 (file)
@@ -25,25 +25,37 @@ my $dump_path = './t/_dump';
     );
 }
 
-plan tests => 4;
+plan tests => 8;
 
-rmtree($dump_path, 1, 0711);
+rmtree($dump_path, 1, 1);
 
 eval { DBICTest::Schema::1->connect($make_dbictest_db::dsn) };
 ok(!$@, 'no death with dump_directory set') or diag "Dump failed: $@";
 
 DBICTest::Schema::1->loader(undef);
-eval { DBICTest::Schema::1->connect($make_dbictest_db::dsn) };
-like($@, qr|DBICTest/Schema/1.pm exists, will not overwrite|,
-    'death when attempting to overwrite without option');
 
-rmtree($dump_path, 1, 0711);
+my @warn_output;
+{
+    local $SIG{__WARN__} = sub { push(@warn_output, @_) };
+    DBICTest::Schema::1->connect($make_dbictest_db::dsn);
+}
+my @warnings_regexes = (
+    qr|Dumping manual schema|,
+    (qr|DBICTest/Schema/1.*?.pm exists, will not overwrite|) x 3,
+    qr|Schema dump completed|,
+);
+
+like(shift @warn_output, $_) foreach (@warnings_regexes);
+
+rmtree($dump_path, 1, 1);
 
 eval { DBICTest::Schema::2->connect($make_dbictest_db::dsn) };
-ok(!$@, 'no death with dump_directory set (overwrite1)') or diag "Dump failed: $@";
+ok(!$@, 'no death with dump_directory set (overwrite1)')
+    or diag "Dump failed: $@";
 
 DBICTest::Schema::2->loader(undef);
 eval { DBICTest::Schema::2->connect($make_dbictest_db::dsn) };
-ok(!$@, 'no death with dump_directory set (overwrite2)') or diag "Dump failed: $@";
+ok(!$@, 'no death with dump_directory set (overwrite2)')
+    or diag "Dump failed: $@";
 
-END { rmtree($dump_path, 1, 0711); }
+END { rmtree($dump_path, 1, 1); }