Sha256: ee6b8d4904b14ab70544e0de1d13292e4b4060bf1f633bb2ca78fd52b37a933c

Contents?: true

Size: 2 KB

Versions: 18

Compression:

Stored size: 2 KB

Contents

describe 'Ridgepole::Client#diff -> migrate' do
  context 'when add column (ext cols)' do
    let(:actual_dsl) {
      <<-EOS
        create_table "items", force: :cascade do |t|
          t.string   "name"
          t.integer  "price"
          t.text     "description"
          t.datetime "created_at",  null: false
          t.datetime "updated_at",  null: false
        end
      EOS
    }

    let(:expected_dsl) {
      <<-EOS
        create_table "items", force: :cascade do |t|
          t.string      "name"
          t.integer     "price"
          t.text        "description"
          t.datetime    "created_at",                      null: false
          t.datetime    "updated_at",                      null: false
          t.daterange   "daterange"
          t.numrange    "numrange"
          t.tsrange     "tsrange"
          t.tstzrange   "tstzrange"
          t.int4range   "int4range"
          t.int8range   "int8range"
          t.binary      "bytea"
          t.boolean     "boolean"
          t.bigint      "bigint"
          t.xml         "xml"
          t.tsvector    "tsvector"
          t.hstore      "hstore"
          t.inet        "inet"
          t.cidr        "cidr"
          t.macaddr     "macaddr"
          t.uuid        "uuid"
          t.json        "json"
          t.jsonb       "jsonb"
          t.ltree       "ltree"
          t.citext      "citext"
          t.point       "point"
          t.bit         "bit",         limit: 1
          t.bit_varying "bit varying"
          t.money       "money",                 scale: 2
        end
      EOS
    }

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

    it {
      delta = subject.diff(expected_dsl)
      expect(delta.differ?).to be_truthy
      expect(subject.dump).to match_fuzzy actual_dsl
      delta.migrate
      if condition(:activerecord_4)
        expected_dsl.sub!('t.bigint      "bigint"', 't.integer     "bigint",      limit: 8')
      end
      expect(subject.dump).to match_fuzzy expected_dsl
    }
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

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