Sha256: ee7cd105be9b98d29388ce1d0737be9a4d4f38a0c789af694edc5ac8e336ada0

Contents?: true

Size: 1.08 KB

Versions: 85

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

package_require('ree_migrator/functions/apply_migrations')

RSpec.describe :apply_migrations do
  link :apply_migrations, from: :ree_migrator
  link :create_migrations_table, from: :ree_migrator

  before do
    Ree.enable_irb_mode
    require_relative('../../db')

    db = ReeMigratorTest::Db.new

    db.tables.each do |table|
      db.drop_table(table)
    end

    create_migrations_table(db)
  end

  after do
    Ree.disable_irb_mode
  end

  it {
    db = ReeMigratorTest::Db.new

    apply_migrations(
      db,
      File.expand_path(
        File.join(__dir__, '../../sample_migrations/migrations.yml')
      ),
      File.expand_path(
        File.join(__dir__, '../../sample_migrations/schema_migrations')
      ),
      File.expand_path(
        File.join(__dir__, '../../sample_migrations/data_migrations')
      )
    )

    data_first = db[:test_table].order(:id).first[:id]
    data_second = db[:test_table].order(:id).all[1][:id]

    expect(db[:test_table].columns.first).to eq(:id)
    expect(data_first).to eq(1)
    expect(data_second).to eq(2)
  }
end

Version data entries

85 entries across 85 versions & 1 rubygems

Version Path
ree_lib-1.0.124 lib/ree_lib/packages/ree_migrator/spec/ree_migrator/functions/apply_migrations_spec.rb
ree_lib-1.0.123 lib/ree_lib/packages/ree_migrator/spec/ree_migrator/functions/apply_migrations_spec.rb
ree_lib-1.0.122 lib/ree_lib/packages/ree_migrator/spec/ree_migrator/functions/apply_migrations_spec.rb
ree_lib-1.0.121 lib/ree_lib/packages/ree_migrator/spec/ree_migrator/functions/apply_migrations_spec.rb
ree_lib-1.0.120 lib/ree_lib/packages/ree_migrator/spec/ree_migrator/functions/apply_migrations_spec.rb
ree_lib-1.0.119 lib/ree_lib/packages/ree_migrator/spec/ree_migrator/functions/apply_migrations_spec.rb
ree_lib-1.0.118 lib/ree_lib/packages/ree_migrator/spec/ree_migrator/functions/apply_migrations_spec.rb
ree_lib-1.0.117 lib/ree_lib/packages/ree_migrator/spec/ree_migrator/functions/apply_migrations_spec.rb
ree_lib-1.0.116 lib/ree_lib/packages/ree_migrator/spec/ree_migrator/functions/apply_migrations_spec.rb
ree_lib-1.0.115 lib/ree_lib/packages/ree_migrator/spec/ree_migrator/functions/apply_migrations_spec.rb
ree_lib-1.0.114 lib/ree_lib/packages/ree_migrator/spec/ree_migrator/functions/apply_migrations_spec.rb
ree_lib-1.0.113 lib/ree_lib/packages/ree_migrator/spec/ree_migrator/functions/apply_migrations_spec.rb
ree_lib-1.0.112 lib/ree_lib/packages/ree_migrator/spec/ree_migrator/functions/apply_migrations_spec.rb
ree_lib-1.0.111 lib/ree_lib/packages/ree_migrator/spec/ree_migrator/functions/apply_migrations_spec.rb
ree_lib-1.0.110 lib/ree_lib/packages/ree_migrator/spec/ree_migrator/functions/apply_migrations_spec.rb
ree_lib-1.0.109 lib/ree_lib/packages/ree_migrator/spec/ree_migrator/functions/apply_migrations_spec.rb
ree_lib-1.0.108 lib/ree_lib/packages/ree_migrator/spec/ree_migrator/functions/apply_migrations_spec.rb
ree_lib-1.0.107 lib/ree_lib/packages/ree_migrator/spec/ree_migrator/functions/apply_migrations_spec.rb
ree_lib-1.0.106 lib/ree_lib/packages/ree_migrator/spec/ree_migrator/functions/apply_migrations_spec.rb
ree_lib-1.0.105 lib/ree_lib/packages/ree_migrator/spec/ree_migrator/functions/apply_migrations_spec.rb