Sha256: e40b9cc5543abcb3fe8c3eb83b50edf88f989803f53224d0c6642c1d31bae4e8

Contents?: true

Size: 1.62 KB

Versions: 18

Compression:

Stored size: 1.62 KB

Contents

describe 'Ridgepole::Client#dump', condition: [:mysql_awesome_enabled, :activerecord_5] do
  let(:template_variables) {
    opts = {
      table_comment: {comment: '"london" bridge "is" falling "down"'},
    }

    if condition(:activerecord_4)
      opts.merge!(
        table_comment: {}
      )
    end

    opts
  }

  let(:actual_dsl) {
    erbh(<<-'EOS', template_variables)
      create_table "books", unsigned: true, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='\"london\" bridge \"is\" falling \"down\"'" do |t|
        t.string   "title",      <%= i limit(255) + {null: false} %>
        t.integer  "author_id",  <%= i limit(4) + {null: false} %>
        t.datetime "created_at"
        t.datetime "updated_at"
      end
    EOS
  }

  context 'when without table options' do
    let(:expected_dsl) {
      erbh(<<-EOS, template_variables)
        create_table "books", <%= i({unsigned: true, force: :cascade} + @table_comment) %> do |t|
          t.string   "title",      <%= i limit(255) + {null: false} %>
          t.integer  "author_id",  <%= i limit(4) + {null: false} %>
          t.datetime "created_at"
          t.datetime "updated_at"
        end
      EOS
    }

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

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

  context 'when with table options' do
    before { subject.diff(actual_dsl).migrate }
    subject { client(dump_without_table_options: false) }

    it {
      if condition(:activerecord_5)
        skip
      else
        expect(subject.dump).to match_fuzzy actual_dsl
      end
    }
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
ridgepole-0.6.6 spec/mysql/dump/dump_without_table_options_spec.rb
ridgepole-0.6.6.beta3 spec/mysql/dump/dump_without_table_options_spec.rb
ridgepole-0.6.6.beta2 spec/mysql/dump/dump_without_table_options_spec.rb
ridgepole-0.6.6.beta spec/mysql/dump/dump_without_table_options_spec.rb
ridgepole-0.6.5 spec/mysql/dump/dump_without_table_options_spec.rb
ridgepole-0.6.5.beta14 spec/mysql/dump/dump_without_table_options_spec.rb
ridgepole-0.6.5.beta13 spec/mysql/dump/dump_without_table_options_spec.rb
ridgepole-0.6.5.beta12 spec/mysql/dump/dump_without_table_options_spec.rb
ridgepole-0.6.5.beta11 spec/mysql/dump/dump_without_table_options_spec.rb
ridgepole-0.6.5.beta10 spec/mysql/dump/dump_without_table_options_spec.rb
ridgepole-0.6.5.beta9 spec/mysql/dump/dump_without_table_options_spec.rb
ridgepole-0.6.5.beta8 spec/mysql/dump/dump_without_table_options_spec.rb
ridgepole-0.6.5.beta7 spec/mysql/dump/dump_without_table_options_spec.rb
ridgepole-0.6.5.beta6 spec/mysql/dump/dump_without_table_options_spec.rb
ridgepole-0.6.5.beta5 spec/mysql/dump/dump_without_table_options_spec.rb
ridgepole-0.6.5.beta4 spec/mysql/dump/dump_without_table_options_spec.rb
ridgepole-0.6.5.beta3 spec/mysql/dump/dump_without_table_options_spec.rb
ridgepole-0.6.5.beta2 spec/mysql/dump/dump_without_table_options_spec.rb