spec/tests/arel_spec.rb in torque-postgresql-2.4.5 vs spec/tests/arel_spec.rb in torque-postgresql-3.0.0

- old
+ new

@@ -49,12 +49,10 @@ end context 'on default value' do let(:connection) { ActiveRecord::Base.connection } - before(:context) { Torque::PostgreSQL.config.use_extended_defaults = true } - after(:context) { Torque::PostgreSQL.config.use_extended_defaults = false } after { Author.reset_column_information } it 'does not break the change column default value method' do connection.add_column(:authors, :enabled, :boolean) expect { connection.change_column_default(:authors, :enabled, { from: nil, to: true }) }.not_to raise_error @@ -62,16 +60,10 @@ 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([]) - result = Torque::PostgreSQL::AR610 ? "'[]'" : "ARRAY[]" - expect(Author.where(condition).to_sql).to eq(<<~SQL.squish) - SELECT "authors".* FROM "authors" WHERE "authors"."profile" IS DISTINCT FROM #{result} - 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([]) @@ -80,18 +72,18 @@ it 'works with an array with enum values for a new enum' do value = ['a', 'b'] expect do connection.create_enum(:samples, %i[a b c d]) - connection.add_column(:authors, :samples, :samples, array: true, default: value) + connection.add_column(:authors, :samples, :enum, enum_type: :samples, array: true, default: value) end.not_to raise_error expect(Author.new.samples).to eq(value) end it 'works with an array with enum values for an existing enum' do value = ['visitor', 'assistant'] - expect { connection.add_column(:authors, :roles, :roles, array: true, default: value) }.not_to raise_error + expect { connection.add_column(:authors, :roles, :enum, enum_type: :roles, array: true, default: value) }.not_to raise_error expect(Author.new.roles).to eq(value) end it 'works with multi dimentional array' do value = [['1', '2'], ['3', '4']]