spec/model/dataset_methods_spec.rb in sequel-3.13.0 vs spec/model/dataset_methods_spec.rb in sequel-3.14.0

- old
+ new

@@ -10,10 +10,11 @@ def self.destroyed class_variable_get(:@@destroyed) end end @d = @c.dataset + MODEL_DB.reset end it "should instantiate objects in the dataset and call destroy on each" do def @d.fetch_rows(sql) yield({:id=>1}) @@ -34,9 +35,21 @@ end @d.destroy.should == 1 def @d.fetch_rows(sql) end @d.destroy.should == 0 + end + + it "should use a transaction if use_transactions is true for the model" do + @c.use_transactions = true + @d.destroy + MODEL_DB.sqls.should == ["BEGIN", "SELECT * FROM items", "COMMIT"] + end + + it "should not use a transaction if use_transactions is false for the model" do + @c.use_transactions = false + @d.destroy + MODEL_DB.sqls.should == ["SELECT * FROM items"] end end describe Sequel::Model::DatasetMethods, "#to_hash" do before do