test/shared/database.rb in upsert-0.2.2 vs test/shared/database.rb in upsert-0.3.0
- old
+ new
@@ -42,28 +42,28 @@
upsert.row({:name => 'Inky'}, {:gender => nil})
upsert.row({:name => 'Inky'}, {:gender => nil})
end
end
end
- describe :stream do
+ describe :batch do
it "works for multiple rows (base case)" do
assert_creates(Pet, [{:name => 'Jerry', :gender => 'male'}]) do
- Upsert.stream(connection, :pets) do |upsert|
+ Upsert.batch(connection, :pets) do |upsert|
upsert.row({:name => 'Jerry'}, :gender => 'male')
end
end
end
it "works for multiple rows (not changing anything)" do
assert_creates(Pet, [{:name => 'Jerry', :gender => 'male'}]) do
- Upsert.stream(connection, :pets) do |upsert|
+ Upsert.batch(connection, :pets) do |upsert|
upsert.row({:name => 'Jerry'}, :gender => 'male')
upsert.row({:name => 'Jerry'}, :gender => 'male')
end
end
end
it "works for multiple rows (changing something)" do
assert_creates(Pet, [{:name => 'Jerry', :gender => 'neutered'}]) do
- Upsert.stream(connection, :pets) do |upsert|
+ Upsert.batch(connection, :pets) do |upsert|
upsert.row({:name => 'Jerry'}, :gender => 'male')
upsert.row({:name => 'Jerry'}, :gender => 'neutered')
end
end
Pet.where(:gender => 'male').count.must_equal 0