Sha256: d35c8ab9b8e0462657097f0024d6521ee32773a2c3c93c9315699a62c5c92e43
Contents?: true
Size: 1.78 KB
Versions: 13
Compression:
Stored size: 1.78 KB
Contents
describe 'Ridgepole::Client#diff -> migrate' do context 'when change column' do let(:actual_dsl) { erbh(<<-EOS) create_table "employees", primary_key: "emp_no", force: :cascade do |t| t.date "birth_date", null: false t.string "first_name", limit: 14, null: false t.string "last_name", limit: 16, null: false t.string "gender", limit: 1, null: false t.date "hire_date", null: false end EOS } let(:expected_dsl) { erbh(<<-EOS) create_table "employees", primary_key: "emp_no2", force: :cascade do |t| t.date "birth_date", null: false t.string "first_name", limit: 14, null: false t.string "last_name", limit: 16, null: false t.string "gender", limit: 1, null: false t.date "hire_date", null: false end EOS } before { subject.diff(actual_dsl).migrate } subject { client } it { expect(Ridgepole::Logger.instance).to receive(:warn).with(<<-EOS) [WARNING] No difference of schema configuration for table `employees` but table options differ. from: {:primary_key=>"emp_no"} to: {:primary_key=>"emp_no2"} EOS delta = subject.diff(expected_dsl) expect(delta.differ?).to be_falsey expect(subject.dump).to match_fuzzy actual_dsl delta.migrate expect(subject.dump).to match_fuzzy actual_dsl } it { expect(Ridgepole::Logger.instance).to receive(:warn).with(<<-EOS) [WARNING] No difference of schema configuration for table `employees` but table options differ. from: {:primary_key=>"emp_no2"} to: {:primary_key=>"emp_no"} EOS delta = Ridgepole::Client.diff(actual_dsl, expected_dsl, reverse: true) expect(delta.differ?).to be_falsey } end end
Version data entries
13 entries across 13 versions & 1 rubygems