Sha256: 4ce7bcb9f54aeee4fc1ca6c53600faf761fc22c2f93e60a0187ec3a98a0c324e

Contents?: true

Size: 1.2 KB

Versions: 8

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

require "spec_helper"

describe DataMigrate::Tasks::DataMigrateTasks do
  let(:db_config) do
    {
      adapter: "sqlite3",
      database: "spec/db/test.db"
    }
  end

  before do
    if Rails::VERSION::MAJOR == 5
      if Rails::VERSION::MINOR == 2
        allow(DataMigrate::Tasks::DataMigrateTasks).to receive(:migrations_paths) {
          "spec/db/data"
        }
      else
        allow(DataMigrate::Tasks::DataMigrateTasks).to receive(:migrations_paths) {
          "spec/db/5.0"
        }
      end
    else
      allow(DataMigrate::Tasks::DataMigrateTasks).to receive(:migrations_paths) {
        "spec/db/4.2"
      }
    end
    allow(DataMigrate::DataMigrator).to receive(:db_config) { db_config }
    ActiveRecord::Base.establish_connection(db_config)
  end

  after do
    ActiveRecord::Migration.drop_table("data_migrations")
  end

  describe :migrate do
    it do
      expect {
        DataMigrate::Tasks::DataMigrateTasks.migrate
      }.to output(/20091231235959 SomeName: migrating/).to_stdout
    end

    it do
      expect {
        DataMigrate::Tasks::DataMigrateTasks.migrate
      }.to output(/20171231235959 SuperUpdate: migrating/).to_stdout
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
data_migrate-5.3.2 spec/data_migrate/tasks/data_migrate_tasks_spec.rb
data_migrate-5.3.1 spec/data_migrate/tasks/data_migrate_tasks_spec.rb
data_migrate-5.3.0 spec/data_migrate/tasks/data_migrate_tasks_spec.rb
data_migrate-5.2.0 spec/data_migrate/tasks/data_migrate_tasks_spec.rb
data_migrate-5.1.0 spec/data_migrate/tasks/data_migrate_tasks_spec.rb
data_migrate-5.0.2 spec/data_migrate/tasks/data_migrate_tasks_spec.rb
data_migrate-5.0.0 spec/data_migrate/tasks/data_migrate_tasks_spec.rb
data_migrate-4.0.0 spec/data_migrate/tasks/data_migrate_tasks_spec.rb