Sha256: 154a27336a1797848a61fbb8b30a6ee341c2736a68862fee62719cf083a791be
Contents?: true
Size: 1.62 KB
Versions: 3
Compression:
Stored size: 1.62 KB
Contents
describe 'Ridgepole::Client#diff -> migrate (with index)', condition: 5.1 do context 'when create table with auto increment column' do let(:actual_dsl) { '' } let(:expected_dsl) { erbh(<<-EOS) create_table "dept_emp", primary_key: ["emp_no", "dept_no"], force: :cascade do |t| t.integer "emp_no", null: false t.integer "dept_no", null: false, auto_increment: true t.date "from_date", null: false t.date "to_date", null: false t.index ["dept_no"], name: "dept_no", <%= i cond(5.0, using: :btree) %> t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %> end EOS } before { subject.diff(actual_dsl).migrate } subject { client(create_table_with_index: true, mysql_dump_auto_increment: true) } it { delta = subject.diff(expected_dsl) expect(delta.differ?).to be_truthy expect(delta.script).to match_fuzzy erbh(<<-EOS) create_table("dept_emp", {:primary_key=>["emp_no", "dept_no"]}) do |t| t.column("emp_no", :"integer", {:null=>false, :limit=>4}) t.column("dept_no", :"integer", {:null=>false, :auto_increment=>true, :limit=>4}) t.column("from_date", :"date", {:null=>false}) t.column("to_date", :"date", {:null=>false}) t.index(["dept_no"], <%= {:name=>"dept_no"} + cond(5.0, using: :btree) %>) t.index(["emp_no"], <%= {:name=>"emp_no"} + cond(5.0, using: :btree) %>) end EOS expect(subject.dump).to match_ruby actual_dsl delta.migrate expect(subject.dump).to match_ruby expected_dsl } end end
Version data entries
3 entries across 3 versions & 1 rubygems