Move the rows/offset sanity checks from DBI to _resolved_attrs
[dbsrgits/DBIx-Class.git] / t / resultset / update_delete.t
index 7d9efa9..f49fb0e 100644 (file)
@@ -140,7 +140,13 @@ $schema->is_executed_sql_bind( sub {
 
 # try the same sql with forced multicolumn in
 $schema->is_executed_sql_bind( sub {
-  local $schema->storage->{_use_multicolumn_in} = 1;
+
+  my $orig_umi = $schema->storage->_use_multicolumn_in;
+  my $sg = Scope::Guard->new(sub {
+    $schema->storage->_use_multicolumn_in($orig_umi);
+  });
+
+  $schema->storage->_use_multicolumn_in(1);
 
   # this can't actually execute on sqlite
   eval { $fks_multi->update ({ read_count => \ 'read_count + 1' }) };
@@ -280,6 +286,10 @@ cmp_ok ($tkfk_cnt, '>', 1, 'More than 1 row left');
 $tkfks->search ({}, { rows => 1 })->delete;
 is ($tkfks->count, $tkfk_cnt -= 1, 'Only one row deleted');
 
+throws_ok {
+  $tkfks->search ({}, { rows => 0 })->delete
+} qr/rows attribute must be a positive integer/;
+is ($tkfks->count, $tkfk_cnt, 'Nothing deleted');
 
 # check with sql-equality, as sqlite will accept most bad sql just fine
 {