Sha256: 54c28c2a8b481bfcb2e425aba527b886f8856139f103f8b4d00d3d33e3d87154

Contents?: true

Size: 1.89 KB

Versions: 8

Compression:

Stored size: 1.89 KB

Contents

describe 'Ridgepole::Client (with pkdump)' do
  let(:dsl) {
    <<-RUBY
      create_table "authors", id: "bigint(20) PRIMARY KEY auto_increment", force: true do |t|
        t.string   "name",       null: false
        t.datetime "created_at"
        t.datetime "updated_at"
      end

      create_table "books", id: "bigint(20) PRIMARY KEY auto_increment", force: true do |t|
        t.string   "title",      null: false
        t.integer  "author_id",  null: false
        t.datetime "created_at"
        t.datetime "updated_at"
      end
    RUBY
  }

  context 'when dump with activerecord-mysql-pkdump' do
    subject { client(enable_mysql_pkdump: true) }

    before { subject.diff(dsl).migrate }

    it {
      expect(subject.dump).to eq dsl.strip_heredoc.strip
    }
  end

  context 'when create with activerecord-mysql-pkdump' do
    subject { client(enable_foreigner: true) }

    it {
      delta = subject.diff(dsl)
      expect(delta.differ?).to be_truthy
      expect(subject.dump.delete_empty_lines).to eq ''
      delta.migrate
      expect(subject.dump.delete_empty_lines).to eq dsl.strip_heredoc.strip.delete_empty_lines
    }
  end

  context 'update create with activerecord-mysql-pkdump' do
    subject { client(enable_foreigner: true) }

    before { subject.diff(dsl).migrate }

    let(:dsl2) {
      <<-RUBY
        create_table "books", id: "bigint(20) PRIMARY KEY auto_increment", force: true do |t|
          t.string   "title2",     null: false
          t.integer  "author_id",  null: false
          t.datetime "created_at"
          t.datetime "updated_at"
        end
      RUBY
    }

    it {
      delta = subject.diff(dsl2)
      expect(delta.differ?).to be_truthy
      expect(subject.dump.delete_empty_lines).to eq dsl.strip_heredoc.strip.delete_empty_lines
      delta.migrate
      expect(subject.dump.delete_empty_lines).to eq dsl2.strip_heredoc.strip.delete_empty_lines
    }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ridgepole-0.5.1 spec/~pkdump/pkdump_spec.rb
ridgepole-0.5.1.beta3 spec/~pkdump/pkdump_spec.rb
ridgepole-0.5.1.beta2 spec/~pkdump/pkdump_spec.rb
ridgepole-0.5.1.beta spec/~pkdump/pkdump_spec.rb
ridgepole-0.5.0 spec/~pkdump/pkdump_spec.rb
ridgepole-0.5.0.beta spec/~pkdump/pkdump_spec.rb
ridgepole-0.4.12 spec/~pkdump/pkdump_spec.rb
ridgepole-0.4.11.beta spec/~pkdump/pkdump_spec.rb