spec/tests/arel_spec.rb in torque-postgresql-3.4.0 vs spec/tests/arel_spec.rb in torque-postgresql-3.4.1
- old
+ new
@@ -60,9 +60,14 @@
end
it 'does not break jsonb' do
expect { connection.add_column(:authors, :profile, :jsonb, default: []) }.not_to raise_error
expect(Author.columns_hash['profile'].default).to eq('[]')
+
+ condition = Author.arel_table['profile'].is_distinct_from([])
+ expect(Author.where(condition).to_sql).to eq(<<~SQL.squish)
+ SELECT "authors".* FROM "authors" WHERE "authors"."profile" IS DISTINCT FROM '[]'
+ SQL
end
it 'works properly when column is an array' do
expect { connection.add_column(:authors, :tag_ids, :bigint, array: true, default: []) }.not_to raise_error
expect(Author.new.tag_ids).to eq([])