Sha256: efb1dc6dc184854d5ef84814a3e79608cba0705d051bf42905f951acd9c48073

Contents?: true

Size: 1.83 KB

Versions: 7

Compression:

Stored size: 1.83 KB

Contents

unless postgresql?
describe 'Ridgepole::Client#diff -> migrate' do
  context 'when change column' do
    let(:actual_dsl) {
      <<-RUBY
        create_table "employees", primary_key: "emp_no"#{unsigned_if_enabled}, force: :cascade 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

      RUBY
    }

    let(:expected_dsl) {
      <<-RUBY
        create_table "employees", primary_key: "emp_no2"#{unsigned_if_enabled}, force: :cascade 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
      RUBY
    }

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

    it {
      expect(Ridgepole::Logger.instance).to receive(:warn).with("[WARNING] No difference of schema configuration for table `employees`. (if you changed some options, please reconfirm your Schemafile)")
      delta = subject.diff(expected_dsl)
      expect(delta.differ?).to be_falsey
      expect(subject.dump).to eq actual_dsl.strip_heredoc.strip
      delta.migrate
      expect(subject.dump).to eq actual_dsl.strip_heredoc.strip
    }

    it {
      expect(Ridgepole::Logger.instance).to receive(:warn).with("[WARNING] No difference of schema configuration for table `employees`. (if you changed some options, please reconfirm your Schemafile)")
      delta = Ridgepole::Client.diff(actual_dsl, expected_dsl, reverse: true)
      expect(delta.differ?).to be_falsey
    }
  end
end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ridgepole-0.6.4 spec/mysql/migrate/migrate_change_table_option_spec.rb
ridgepole-0.6.4.beta9 spec/mysql/migrate/migrate_change_table_option_spec.rb
ridgepole-0.6.4.beta8 spec/mysql/migrate/migrate_change_table_option_spec.rb
ridgepole-0.6.4.beta7 spec/mysql/migrate/migrate_change_table_option_spec.rb
ridgepole-0.6.4.beta6 spec/mysql/migrate/migrate_change_table_option_spec.rb
ridgepole-0.6.4.beta5 spec/mysql/migrate/migrate_change_table_option_spec.rb
ridgepole-0.6.4.beta4 spec/mysql/migrate/migrate_change_table_option_spec.rb