Sha256: 74dad7a02502bfa01492fb7d8b76447575cf094b1cb6f29cd6635226569ccbd3

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

describe 'Ridgepole::Client#diff -> migrate' do
  before { subject.diff(actual_dsl).migrate }
  subject { client(:table_options => table_options, :dump_without_table_options => false) }

  let(:warning_regexp) { /table options differ/ }

  let(:actual_dsl) {
    erbh(<<-EOS)
      create_table "employees", primary_key: "emp_no", force: :cascade, options: 'ENGINE=InnoDB DEFAULT CHARSET=utf8' do |t|
      end
    EOS
  }

  let(:expected_dsl) {
    erbh(<<-EOS)
      create_table :employees, primary_key: :emp_no, force: :cascade do |t|
      end
    EOS
  }

  context 'when change options (no change)' do
    let(:table_options) { 'ENGINE=InnoDB DEFAULT CHARSET=utf8' }

    it {
      expect(Ridgepole::Logger.instance).to_not receive(:warn).with(warning_regexp)
      delta = subject.diff(expected_dsl)
      expect(delta.differ?).to be_falsey
    }
  end

  context 'when change options (change)' do
    let(:table_options) { 'ENGINE=InnoDB DEFAULT CHARSET=utf8mb4' }

    it {
      expect(Ridgepole::Logger.instance).to receive(:warn).with(warning_regexp)
      delta = subject.diff(expected_dsl)
      expect(delta.differ?).to be_falsey
    }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ridgepole-0.7.0.beta20 spec/mysql/migrate/migrate_change_column8_spec.rb
ridgepole-0.7.0.beta19 spec/mysql/migrate/migrate_change_column8_spec.rb