spec/postgresql/diff/diff_spec.rb in ridgepole-0.7.3.beta vs spec/postgresql/diff/diff_spec.rb in ridgepole-0.7.3.beta2

- old
+ new

@@ -2,12 +2,12 @@ before do allow(Ridgepole::Diff).to receive(:postgresql?).and_return(true) end context 'when change column' do - let(:actual_dsl) { - <<-EOS + let(:actual_dsl) do + <<-RUBY create_table "clubs", force: :cascade do |t| t.string "name", limit: 255, default: "", null: false end add_index "clubs", ["name"], name: "idx_name", unique: true, using: :btree @@ -67,15 +67,15 @@ t.date "from_date", null: false t.date "to_date" end add_index "titles", ["emp_no"], name: "idx_titles_emp_no", using: :btree - EOS - } + RUBY + end - let(:expected_dsl) { - <<-EOS + let(:expected_dsl) do + <<-RUBY create_table "clubs", force: :cascade do |t| t.string "name", limit: 255, default: "", null: false end add_index "clubs", ["name"], name: "idx_name", unique: true, using: :btree @@ -135,43 +135,43 @@ t.date "from_date", null: false t.date "to_date" end add_index "titles", ["emp_no"], name: "idx_titles_emp_no", using: :btree - EOS - } + RUBY + end subject { Ridgepole::Client } it { delta = subject.diff(actual_dsl, expected_dsl) expect(delta.differ?).to be_truthy - expect(delta.script).to match_fuzzy <<-EOS + expect(delta.script).to match_fuzzy <<-RUBY change_column("employee_clubs", "club_id", :integer, {:null=>true, :default=>nil}) change_column("employees", "last_name", :string, {:limit=>20, :default=>"XXX"}) - EOS + RUBY } end describe 'column position warning' do subject { Ridgepole::Client } context 'when adding a column to the last' do - let(:actual_dsl) { <<-EOS } + let(:actual_dsl) { <<-RUBY } create_table "users", force: :cascade do |t| t.string "name", null: false end - EOS + RUBY - let(:expected_dsl) { <<-EOS } + let(:expected_dsl) { <<-RUBY } create_table "users", force: :cascade do |t| t.string "name", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false end - EOS + RUBY # XXX: before { client } it "doesn't warn anything" do @@ -181,23 +181,23 @@ expect(delta.script).to_not include('after') end end context 'when adding a column to the middle' do - let(:actual_dsl) { <<-EOS } + let(:actual_dsl) { <<-RUBY } create_table "users", force: :cascade do |t| t.datetime "created_at", null: false end - EOS + RUBY - let(:expected_dsl) { <<-EOS } + let(:expected_dsl) { <<-RUBY } create_table "users", force: :cascade do |t| t.string "name", null: false t.integer "age", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false end - EOS + RUBY # XXX: before { client } it 'warns position' do