test/shared/database.rb in upsert-0.3.3 vs test/shared/database.rb in upsert-0.3.4

- old
+ new

@@ -34,22 +34,35 @@ upsert.row({:name => 'Jerry'}, {:gender => 'male'}) upsert.row({:name => 'Jerry'}, {:gender => 'neutered'}) end Pet.where(:gender => 'male').count.must_equal 0 end - it "works for a single row with implicit nulls" do upsert = Upsert.new connection, :pets assert_creates(Pet, [{:name => 'Inky', :gender => nil}]) do upsert.row({:name => 'Inky'}, {}) upsert.row({:name => 'Inky'}, {}) end end + it "works for a single row with empty document" do + upsert = Upsert.new connection, :pets + assert_creates(Pet, [{:name => 'Inky', :gender => nil}]) do + upsert.row(:name => 'Inky') + upsert.row(:name => 'Inky') + end + end it "works for a single row with explicit nulls" do upsert = Upsert.new connection, :pets assert_creates(Pet, [{:name => 'Inky', :gender => nil}]) do upsert.row({:name => 'Inky'}, {:gender => nil}) upsert.row({:name => 'Inky'}, {:gender => nil}) + end + end + it "works with ids" do + jerry = Pet.create :name => 'Jerry', :lovability => 1.0 + upsert = Upsert.new connection, :pets + assert_creates(Pet, [{:name => 'Jerry', :lovability => 2.0}]) do + upsert.row({:id => jerry.id}, :lovability => 2.0) end end end describe :batch do it "works for multiple rows (base case)" do