Sha256: 7c6dd0f4774bada8bb20a9e3776914df37e337fe87f93eaa8938dcb2337d83d5

Contents?: true

Size: 1.54 KB

Versions: 15

Compression:

Stored size: 1.54 KB

Contents

# frozen_string_literal: true

describe 'Ridgepole::Client#diff -> migrate' do
  context 'when change mysql table options' do
    let(:actual_dsl) do
      erbh(<<-ERB)
        create_table "employees", primary_key: "emp_no", force: :cascade, options: "ENGINE=MyISAM DEFAULT CHARSET=utf8" do |t|
          t.date   "birth_date", null: false
          t.string "first_name", limit: 14, null: false
          t.string "last_name", limit: 16, null: false
          t.string "gender", limit: 1, null: false
          t.date   "hire_date", null: false
        end
      ERB
    end

    let(:expected_dsl) do
      erbh(<<-ERB)
        create_table "employees", primary_key: "emp_no", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=ascii" do |t|
          t.date   "birth_date", null: false
          t.string "first_name", limit: 14, null: false, <%= i cond('>= 5.2', collation: "utf8_general_ci") %>
          t.string "last_name", limit: 16, null: false, <%= i cond('>= 5.2', collation: "utf8_general_ci") %>
          t.string "gender", limit: 1, null: false, <%= i cond('>= 5.2', collation: "utf8_general_ci") %>
          t.date   "hire_date", null: false
        end
      ERB
    end

    before { subject.diff(actual_dsl).migrate }
    subject { client(dump_without_table_options: false, mysql_change_table_options: true) }

    it {
      delta = subject.diff(expected_dsl)
      expect(delta.differ?).to be_truthy
      expect(subject.dump).to match_ruby actual_dsl
      delta.migrate
      expect(subject.dump).to match_ruby expected_dsl
    }
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ridgepole-0.8.13 spec/mysql/_migrate/migrate_change_table_option_spec.rb
ridgepole-0.8.12 spec/mysql/_migrate/migrate_change_table_option_spec.rb
ridgepole-0.8.11 spec/mysql/_migrate/migrate_change_table_option_spec.rb
ridgepole-0.8.10 spec/mysql/_migrate/migrate_change_table_option_spec.rb
ridgepole-0.8.9 spec/mysql/_migrate/migrate_change_table_option_spec.rb
ridgepole-0.8.8 spec/mysql/_migrate/migrate_change_table_option_spec.rb
ridgepole-0.8.7 spec/mysql/_migrate/migrate_change_table_option_spec.rb
ridgepole-0.8.6 spec/mysql/_migrate/migrate_change_table_option_spec.rb
ridgepole-0.8.5 spec/mysql/_migrate/migrate_change_table_option_spec.rb
ridgepole-0.8.4 spec/mysql/_migrate/migrate_change_table_option_spec.rb
ridgepole-0.8.3 spec/mysql/_migrate/migrate_change_table_option_spec.rb
ridgepole-0.8.2 spec/mysql/_migrate/migrate_change_table_option_spec.rb
ridgepole-0.8.1 spec/mysql/_migrate/migrate_change_table_option_spec.rb
ridgepole-0.8.0 spec/mysql/_migrate/migrate_change_table_option_spec.rb
ridgepole-0.8.0.rc2 spec/mysql/_migrate/migrate_change_table_option_spec.rb