Sha256: b5b3cd5e18721b0e49cc1372ff53493ffa0305807dc098205d8410e33134960d

Contents?: true

Size: 1.14 KB

Versions: 16

Compression:

Stored size: 1.14 KB

Contents

if postgresql?
describe 'Ridgepole::Client#diff -> migrate' do
  context 'when change column' do
    let(:actual_dsl) {
      <<-RUBY
        create_table "salaries", id: false, force: :cascade do |t|
          t.integer "emp_no",    default: 0, null: false
          t.integer "salary",                null: false
          t.date    "from_date",             null: false
          t.date    "to_date",               null: false
        end
      RUBY
    }

    let(:expected_dsl) {
      <<-RUBY
        create_table "salaries", id: false, force: :cascade do |t|
          t.integer "emp_no",    null: false
          t.integer "salary",    null: false
          t.date    "from_date", null: false
          t.date    "to_date",   null: false
        end
      RUBY
    }

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

    it {
      delta = subject.diff(expected_dsl)
      expect(delta.differ?).to be_truthy
      expect(subject.dump).to eq actual_dsl.strip_heredoc.strip
      delta.migrate
      expect(subject.dump).to eq expected_dsl.strip_heredoc.strip #.gsub(/(\s*,\s*unsigned: false)?\s*,\s*null: true/, '')
    }
  end
end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ridgepole-0.6.4 spec/postgresql/migrate/migrate_change_column_default_spec.rb
ridgepole-0.6.4.beta9 spec/postgresql/migrate/migrate_change_column_default_spec.rb
ridgepole-0.6.4.beta8 spec/postgresql/migrate/migrate_change_column_default_spec.rb
ridgepole-0.6.4.beta7 spec/postgresql/migrate/migrate_change_column_default_spec.rb
ridgepole-0.6.4.beta6 spec/postgresql/migrate/migrate_change_column_default_spec.rb
ridgepole-0.6.4.beta5 spec/postgresql/migrate/migrate_change_column_default_spec.rb
ridgepole-0.6.4.beta4 spec/postgresql/migrate/migrate_change_column_default_spec.rb
ridgepole-0.6.4.beta3 spec/postgresql/migrate/migrate_change_column_default_spec.rb
ridgepole-0.6.4.beta2 spec/postgresql/migrate/migrate_change_column_default_spec.rb
ridgepole-0.6.4.beta spec/postgresql/migrate/migrate_change_column_default_spec.rb
ridgepole-0.6.3 spec/postgresql/migrate/migrate_change_column_default_spec.rb
ridgepole-0.6.3.beta5 spec/postgresql/migrate/migrate_change_column_default_spec.rb
ridgepole-0.6.3.beta4 spec/postgresql/migrate/migrate_change_column_default_spec.rb
ridgepole-0.6.3.beta3 spec/postgresql/migrate/migrate_change_column_default_spec.rb
ridgepole-0.6.3.beta2 spec/postgresql/migrate/migrate_change_column_default_spec.rb
ridgepole-0.6.3.beta spec/postgresql/migrate/migrate_change_column_default_spec.rb