spec/arel/array_spec.rb in postgres_ext-0.0.8 vs spec/arel/array_spec.rb in postgres_ext-0.0.9

- old
+ new

@@ -4,10 +4,11 @@ let!(:adapter) { ActiveRecord::Base.connection } before do adapter.create_table :arel_arrays, :force => true do |t| t.string :tags, :array => true + t.integer :tag_ids, :array => true end class ArelArray < ActiveRecord::Base attr_accessible :tags end @@ -20,10 +21,16 @@ describe 'Array Overlap' do it 'converts Arel array_overlap statment' do arel_table = ArelArray.arel_table - arel_table.where(arel_table[:tags].array_overlap(['tag','tag 2'])).to_sql.should match /&& '\{tag,tag 2\}'/ + arel_table.where(arel_table[:tags].array_overlap(['tag','tag 2'])).to_sql.should match /&& '\{"tag","tag 2"\}'/ + end + + it 'converts Arel array_overlap statment' do + arel_table = ArelArray.arel_table + + arel_table.where(arel_table[:tag_ids].array_overlap([1,2])).to_sql.should match /&& '\{1,2\}'/ end it 'returns matched records' do one = ArelArray.create!(:tags => ['one']) two = ArelArray.create!(:tags => ['two'])