Sha256: fa16d15f4ad8fa2d63660e20d26ea75980471913a348c20c07240e1b7b8f2098
Contents?: true
Size: 1.42 KB
Versions: 6
Compression:
Stored size: 1.42 KB
Contents
describe 'Ridgepole::Client#diff -> migrate' do context 'when drop column and unique index' do let(:actual_dsl) { erbh(<<-EOS) create_table "employees", primary_key: "emp_no", force: :cascade do |t| t.string "first_name", limit: 14, null: false t.string "last_name", limit: 16, null: false t.index ["first_name", "last_name"], name: "first_name_last_name", unique: true, <%= i cond(5.0, using: :btree) %> end EOS } let(:expected_dsl) { erbh(<<-EOS) create_table "employees", primary_key: "emp_no", force: :cascade do |t| t.string "first_name", limit: 14, null: false end EOS } before do subject.diff(actual_dsl).migrate ActiveRecord::Base.connection.execute(<<-'SQL' insert into employees (first_name, last_name) values ('Taro', 'Yamada'), ('Taro', 'Sato') ; SQL ) end subject { client } it { delta = subject.diff(expected_dsl) expect(delta.differ?).to be_truthy expect(subject.dump).to match_fuzzy actual_dsl delta.migrate expect(subject.dump).to match_fuzzy expected_dsl } it { delta = subject.diff(expected_dsl) expect(delta.differ?).to be_truthy expect(subject.dump).to match_fuzzy actual_dsl delta.migrate(:noop => true) expect(subject.dump).to match_fuzzy actual_dsl } end end
Version data entries
6 entries across 6 versions & 1 rubygems