Sha256: 9508a87e9c61bf711c73ed8367140c6db4162467e4557e77e814de5b503bc80c

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

describe 'Ridgepole::Client#dump' do
  let(:actual_dsl) do
    erbh(<<-'ERB')
      create_table "books", unsigned: true, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='\"london\" bridge \"is\" falling \"down\"'" do |t|
        t.string   "title", null: false
        t.integer  "author_id", null: false
        t.datetime "created_at"
        t.datetime "updated_at"
      end
    ERB
  end

  context 'when without table options' do
    let(:expected_dsl) do
      erbh(<<-ERB)
        create_table "books", <%= i cond({ '>= 6.1' => { id: { type: :bigint, unsigned: true } }, '> 5.1, < 6.1' => { id: :bigint, unsigned: true } }, { unsigned: true }) %>, force: :cascade, comment: "\\"london\\" bridge \\"is\\" falling \\"down\\"" do |t|
          t.string   "title", null: false
          t.integer  "author_id", null: false
          t.datetime "created_at"
          t.datetime "updated_at"
        end
      ERB
    end

    before { subject.diff(actual_dsl).migrate }
    subject { client }

    it {
      expect(subject.dump).to match_ruby expected_dsl
    }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ridgepole-0.9.0.beta spec/mysql/dump/dump_without_table_options_spec.rb