Cascading delete needs a guard to remain atomic
[dbsrgits/DBIx-Class.git] / t / 81transactions.t
index 2a592e1..a13c651 100644 (file)
@@ -150,10 +150,9 @@ my $fail_code = sub {
   no warnings 'redefine';
   no strict 'refs';
 
-  # die in rollback, but maintain sanity for further tests ...
+  # die in rollback
   local *{"DBIx::Class::Storage::DBI::SQLite::txn_rollback"} = sub{
     my $storage = shift;
-    $storage->{transaction_depth}--;
     die 'FAILED';
   };
 
@@ -180,6 +179,9 @@ my $fail_code = sub {
   $schema->storage->_dbh->rollback;
 }
 
+# reset schema object (the txn_rollback meddling screws it up)
+$schema = DBICTest->init_schema();
+
 # Test nested failed txn_do()
 {
   is( $schema->storage->{transaction_depth}, 0, 'txn depth starts at 0');