spec/extensions/composition_spec.rb in sequel-3.45.0 vs spec/extensions/composition_spec.rb in sequel-3.46.0

- old
+ new

@@ -88,14 +88,33 @@ called.should == false @o.save_changes called.should == true end - it "should clear compositions cache when reloading" do + it "should clear compositions cache when using set_values" do @c.composition :date, :composer=>proc{}, :decomposer=>proc{called = true} @o.date = Date.new(3, 4, 5) - @o.reload + @o.set_values(:id=>1) @o.compositions.should == {} + end + + it "should clear compositions cache when refreshing" do + @c.composition :date, :composer=>proc{}, :decomposer=>proc{called = true} + @o.date = Date.new(3, 4, 5) + @o.refresh + @o.compositions.should == {} + end + + it "should clear compositions cache when refreshing after save" do + @c.composition :date, :composer=>proc{}, :decomposer=>proc{called = true} + @c.create(:date=>Date.new(3, 4, 5)).compositions.should == {} + end + + it "should clear compositions cache when saving with insert_select" do + def (@c.instance_dataset).supports_insert_select?() true end + def (@c.instance_dataset).insert_select(*) {:id=>1} end + @c.composition :date, :composer=>proc{}, :decomposer=>proc{called = true} + @c.create(:date=>Date.new(3, 4, 5)).compositions.should == {} end it "should instantiate compositions lazily" do @c.composition :date, :mapping=>[:year, :month, :day] @o.compositions.should == {}