test/functional/schema.rb in mosql-0.3.1 vs test/functional/schema.rb in mosql-0.3.2
- old
+ new
@@ -8,10 +8,11 @@
:meta:
:table: sqltable
:columns:
- _id: TEXT
- var: INTEGER
+ - arry: INTEGER ARRAY
with_extra_props:
:meta:
:table: sqltable2
:extra_props: true
:columns:
@@ -42,28 +43,29 @@
def table; @sequel[:sqltable]; end
def table2; @sequel[:sqltable2]; end
def table3; @sequel[:sqltable3]; end
it 'Creates the tables with the right columns' do
- assert_equal(Set.new([:_id, :var]),
+ assert_equal(Set.new([:_id, :var, :arry]),
Set.new(table.columns))
assert_equal(Set.new([:_id, :_extra_props]),
Set.new(table2.columns))
end
it 'Can COPY data' do
objects = [
{'_id' => "a", 'var' => 0},
- {'_id' => "b", 'var' => 1},
+ {'_id' => "b", 'var' => 1, 'arry' => "{1, 2, 3}"},
{'_id' => "c"},
{'_id' => "d", 'other_var' => "hello"}
]
@map.copy_data(@sequel, 'db.collection', objects.map { |o| @map.transform('db.collection', o) } )
assert_equal(4, table.count)
rows = table.select.sort_by { |r| r[:_id] }
assert_equal(%w[a b c d], rows.map { |r| r[:_id] })
assert_equal(nil, rows[2][:var])
assert_equal(nil, rows[3][:var])
+ assert_equal([1 ,2, 3], rows[1][:arry])
end
it 'Can COPY dotted data' do
objects = [
{'_id' => "a", 'vars' => {'a' => 1, 'b' => 2}},