spec/integration/plugin_test.rb in sequel-3.47.0 vs spec/integration/plugin_test.rb in sequel-3.48.0

- old
+ new

@@ -491,42 +491,10 @@ a.first.artist.should == @artist1 a.map{|x| x.associations}.should == [{:artist=>@artist1}, {:artist=>@artist1}, {:artist=>@artist2}, {:artist=>@artist3}] end end -describe "Identity Map plugin" do - before do - @db = INTEGRATION_DB - @db.create_table!(:items) do - primary_key :id - String :name - Integer :num - end - class ::Item < Sequel::Model(@db) - plugin :identity_map - end - Item.create(:name=>'J', :num=>3) - end - after do - @db.drop_table?(:items) - Object.send(:remove_const, :Item) - end - - specify "should return the same instance if retrieved more than once" do - Item.with_identity_map{Item.first.object_id.should == Item.first.object_id} - end - - specify "should merge attributes that don't exist in the model" do - Item.with_identity_map do - i = Item.select(:id, :name).first - i.values.should == {:id=>1, :name=>'J'} - Item.first - i.values.should == {:id=>1, :name=>'J', :num=>3} - end - end -end - describe "Touch plugin" do before(:all) do @db = INTEGRATION_DB @db.drop_table? :albums_artists, :albums, :artists @db.create_table(:artists) do @@ -1058,11 +1026,11 @@ specify "should handle regular updates" do @c.first.update(:b=>4) @db[:t].all.should == [{:a=>1, :b=>4}] @c.first.set(:b=>5).save @db[:t].all.should == [{:a=>1, :b=>5}] - @c.first.set(:b=>6).save(:b) + @c.first.set(:b=>6).save(:columns=>:b) @db[:t].all.should == [{:a=>1, :b=>6}] end specify "should handle updating the primary key field with another field" do @c.first.update(:a=>2, :b=>4) @@ -1070,11 +1038,11 @@ end specify "should handle updating just the primary key field when saving changes" do @c.first.update(:a=>2) @db[:t].all.should == [{:a=>2, :b=>3}] - @c.first.set(:a=>3).save(:a) + @c.first.set(:a=>3).save(:columns=>:a) @db[:t].all.should == [{:a=>3, :b=>3}] end specify "should handle saving after modifying the primary key field with another field" do @c.first.set(:a=>2, :b=>4).save @@ -1428,11 +1396,11 @@ @c = Class.new(Sequel::Model(@db[:sites])) @c.plugin :list end before do - @c.delete + @c.dataset.delete @c.create :name => "abc" @c.create :name => "def" @c.create :name => "hig" end after(:all) do @@ -1503,11 +1471,11 @@ @c = Class.new(Sequel::Model(@db[:pages])) @c.plugin :list, :field => :pos, :scope => :parent_id end before do - @c.delete + @c.dataset.delete p1 = @c.create :name => "Hm", :parent_id => 0 p2 = @c.create :name => "Ps", :parent_id => p1.id @c.create :name => "P1", :parent_id => p2.id @c.create :name => "P2", :parent_id => p2.id @c.create :name => "P3", :parent_id => p2.id @@ -1744,11 +1712,11 @@ end @c = Class.new(Sequel::Model(@db[:ps_test])) @c.plugin :prepared_statements_with_pk end before do - @c.delete + @c.dataset.delete @foo = @c.create(:name=>'foo', :i=>10) @bar = @c.create(:name=>'bar', :i=>20) end after(:all) do @db.drop_table?(:ps_test) @@ -1940,16 +1908,16 @@ end it "should set up automatic validations inside the model" do c = Class.new(Sequel::Model(@ds)) c.plugin :constraint_validations - c.delete + c.dataset.delete proc{c.create(@valid_row)}.should_not raise_error # Test for unique validation c.new(@valid_row).should_not be_valid - c.delete + c.dataset.delete @violations.each do |col, vals| try = @valid_row.dup vals.each do |val| next if val.nil? && @validation_opts[:allow_nil] try[col] = val