Sha256: 51c675822d6837c5a230db8f42284e7e77ca86f86955a75d91ca15c7d620883f

Contents?: true

Size: 1.54 KB

Versions: 12

Compression:

Stored size: 1.54 KB

Contents

describe 'Ridgepole::Client#diff -> migrate' do
  context 'when add bigint column' do
    let(:actual_dsl) { '' }

    let(:expected_dsl) {
      if condition(:activerecord_5)
        erbh(<<-EOS)
          create_table "bigint_test", id: false, force: :cascade do |t|
            t.bigint "b"
          end
        EOS
      else
        erbh(<<-EOS)
          create_table "bigint_test", id: false, force: :cascade do |t|
            t.integer "b", limit: 8
          end
        EOS
      end
    }

    before { subject.diff(actual_dsl).migrate }
    subject { client }

    it {
      delta = subject.diff(expected_dsl)
      expect(delta.differ?).to be_truthy
      delta.migrate
      expect(subject.dump).to match_fuzzy expected_dsl
    }
  end

  context 'when no change' do
    let(:dsl) {
      erbh(<<-EOS)
        create_table "bigint_test", id: false, force: :cascade do |t|
          t.bigint "b"
        end
      EOS
    }

    let(:expected_dsl) {
      if condition(:activerecord_5)
        erbh(<<-EOS)
          create_table "bigint_test", id: false, force: :cascade do |t|
            t.bigint "b"
          end
        EOS
      else
        erbh(<<-EOS)
          create_table "bigint_test", id: false, force: :cascade do |t|
            t.integer "b", limit: 8
          end
        EOS
      end
    }

    before { subject.diff(dsl).migrate }
    subject { client }

    it {
      delta = subject.diff(expected_dsl)
      expect(delta.differ?).to be_falsey
      delta.migrate
      expect(subject.dump).to match_fuzzy expected_dsl
    }
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ridgepole-0.6.6 spec/postgresql/migrate/migrate_bigint_spec.rb
ridgepole-0.6.6.beta3 spec/postgresql/migrate/migrate_bigint_spec.rb
ridgepole-0.6.6.beta2 spec/postgresql/migrate/migrate_bigint_spec.rb
ridgepole-0.6.6.beta spec/postgresql/migrate/migrate_bigint_spec.rb
ridgepole-0.6.5 spec/postgresql/migrate/migrate_bigint_spec.rb
ridgepole-0.6.5.beta14 spec/postgresql/migrate/migrate_bigint_spec.rb
ridgepole-0.6.5.beta13 spec/postgresql/migrate/migrate_bigint_spec.rb
ridgepole-0.6.5.beta12 spec/postgresql/migrate/migrate_bigint_spec.rb
ridgepole-0.6.5.beta11 spec/postgresql/migrate/migrate_bigint_spec.rb
ridgepole-0.6.5.beta10 spec/postgresql/migrate/migrate_bigint_spec.rb
ridgepole-0.6.5.beta9 spec/postgresql/migrate/migrate_bigint_spec.rb
ridgepole-0.6.5.beta8 spec/postgresql/migrate/migrate_bigint_spec.rb