test/shared/database.rb in upsert-0.3.0 vs test/shared/database.rb in upsert-0.3.1
- old
+ new
@@ -11,9 +11,17 @@
assert_creates(Pet, [{:name => 'Jerry', :gender => 'male', :tag_number => 4}]) do
upsert.row({:name => 'Jerry', :gender => 'male'}, {:tag_number => 1})
upsert.row({:name => 'Jerry', :gender => 'male'}, {:tag_number => 4})
end
end
+ it "doesn't nullify columns that are not included in the selector or document" do
+ assert_creates(Pet, [{:name => 'Jerry', :gender => 'male', :tag_number => 4}]) do
+ one = Upsert.new connection, :pets
+ one.row({:name => 'Jerry'}, {:gender => 'male'})
+ two = Upsert.new connection, :pets
+ two.row({:name => 'Jerry'}, {:tag_number => 4})
+ end
+ end
it "works for a single row (not changing anything)" do
upsert = Upsert.new connection, :pets
assert_creates(Pet, [{:name => 'Jerry', :gender => 'male'}]) do
upsert.row({:name => 'Jerry'}, {:gender => 'male'})
upsert.row({:name => 'Jerry'}, {:gender => 'male'})