Sha256: 2b70e121385440963efa90f5bde4a7f6692091038e73b95f82a5ba0a10cd79cb

Contents?: true

Size: 1.95 KB

Versions: 3

Compression:

Stored size: 1.95 KB

Contents

describe 'Ridgepole::Client#diff -> migrate' do
  context 'when change float column' do
    let(:actual_dsl) {
      erbh(<<-EOS)
        create_table "salaries", id: false, force: :cascade do |t|
          t.integer "emp_no", null: false
          t.float   "salary", limit: 24, null: false
          t.date    "from_date", null: false
          t.date    "to_date", null: false
        end
      EOS
    }

    let(:expected_dsl) {
      <<-EOS
        create_table "salaries", id: false, force: :cascade do |t|
          t.integer "emp_no", null: false
          t.float   "salary", null: false
          t.date    "from_date", null: false
          t.date    "to_date", null: false
        end
      EOS
    }

    before { subject.diff(actual_dsl).migrate }
    subject { client(default_float_limit: 0) }

    it {
      delta = subject.diff(expected_dsl)

      if condition('< 5.2.0.beta2')
        expect(delta.differ?).to be_truthy
        expect(subject.dump).to match_ruby actual_dsl
        delta.migrate
        expect(subject.dump).to match_ruby actual_dsl
      else
        expect(delta.differ?).to be_falsy
      end
    }
  end

  context 'when change float column (no change)' do
    let(:actual_dsl) {
      <<-EOS
        create_table "salaries", id: false, force: :cascade do |t|
          t.integer "emp_no", null: false
          t.float   "salary", limit: 24, null: false
          t.date    "from_date", null: false
          t.date    "to_date", null: false
        end
      EOS
    }

    let(:expected_dsl) {
      <<-EOS
        create_table "salaries", id: false, force: :cascade do |t|
          t.integer "emp_no", null: false
          t.float   "salary", null: false
          t.date    "from_date", null: false
          t.date    "to_date", null: false
        end
      EOS
    }

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ridgepole-0.7.3.beta spec/mysql/migrate/migrate_change_column_float_spec.rb
ridgepole-0.7.2 spec/mysql/migrate/migrate_change_column_float_spec.rb
ridgepole-0.7.2.beta spec/mysql/migrate/migrate_change_column_float_spec.rb