test/functional/sql.rb in mosql-0.1.2 vs test/functional/sql.rb in mosql-0.2.0
- old
+ new
@@ -14,24 +14,24 @@
@table = sequel[:test_upsert]
end
describe 'upsert' do
it 'inserts new items' do
- @adapter.upsert!(@table, {'_id' => 0, 'color' => 'red', 'quantity' => 10})
- @adapter.upsert!(@table, {'_id' => 1, 'color' => 'blue', 'quantity' => 5})
+ @adapter.upsert!(@table, '_id', {'_id' => 0, 'color' => 'red', 'quantity' => 10})
+ @adapter.upsert!(@table, '_id', {'_id' => 1, 'color' => 'blue', 'quantity' => 5})
assert_equal(2, @table.count)
assert_equal('red', @table[:_id => 0][:color])
assert_equal(10, @table[:_id => 0][:quantity])
assert_equal('blue', @table[:_id => 1][:color])
assert_equal(5, @table[:_id => 1][:quantity])
end
it 'updates items' do
- @adapter.upsert!(@table, {'_id' => 0, 'color' => 'red', 'quantity' => 10})
+ @adapter.upsert!(@table, '_id', {'_id' => 0, 'color' => 'red', 'quantity' => 10})
assert_equal(1, @table.count)
assert_equal('red', @table[:_id => 0][:color])
- @adapter.upsert!(@table, {'_id' => 0, 'color' => 'blue', 'quantity' => 5})
+ @adapter.upsert!(@table, '_id', {'_id' => 0, 'color' => 'blue', 'quantity' => 5})
assert_equal(1, @table.count)
assert_equal('blue', @table[:_id => 0][:color])
end
end
end