spec/pgrel/hstore_spec.rb in pgrel-0.1.0 vs spec/pgrel/hstore_spec.rb in pgrel-0.1.1
- old
+ new
@@ -22,19 +22,24 @@
Hstore.create!(name: 'a', tags: { a: 1, b: 2, f: true, d: 'a', g: 'b' })
Hstore.create!(name: 'b', tags: { a: 2, d: 'b', g: 'e' })
Hstore.create!(name: 'c', tags: { f: true, d: 'b' })
Hstore.create!(name: 'd', tags: { f: false })
Hstore.create!(name: 'e', tags: { a: 2, c: 'x', d: 'c', g: 'c' })
+ Hstore.create!(tags: { 1 => 2 })
end
context '#where' do
it 'simple values' do
expect(Hstore.where.store(:tags, a: 1, b: 2).first.name).to eq 'a'
expect(Hstore.where.store(:tags, a: 2, c: 'x').first.name).to eq 'e'
expect(Hstore.where.store(:tags, f: false).first.name).to eq 'd'
end
+ it 'integer keys' do
+ expect(Hstore.where.store(:tags, 1 => 2).size).to eq 1
+ end
+
it 'arrays' do
expect(Hstore.where.store(:tags, a: [1, 2, 3]).size).to eq 3
end
it 'many arrays' do
@@ -113,13 +118,13 @@
it '#where' do
expect(Hstore.where.store(:tags).not(a: 1, g: 'c').size).to eq 1
end
it '#any' do
- expect(Hstore.where.store(:tags).not.any('a', 'f').size).to eq 0
+ expect(Hstore.where.store(:tags).not.any('a', 'f').size).to eq 1
end
it '#keys' do
- expect(Hstore.where.store(:tags).not.keys('a', 'f').size).to eq 4
+ expect(Hstore.where.store(:tags).not.keys('a', 'f').size).to eq 5
end
end
end