Sha256: ad88f561bf38502050b26e86d81a1bbacc4e20a91e2f14e17aecb548c29858b4

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

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

  describe :assure_data_schema_table do
    before do
      expect(subject).to receive(:db_config) { db_config }.at_least(:once)
      ActiveRecord::Base.establish_connection(db_config)
    end

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

    it do
      expect(
        ActiveRecord::Base.connection.table_exists?("data_migrations")
      ).to eq false
      subject.assure_data_schema_table
      expect(
        ActiveRecord::Base.connection.table_exists?("data_migrations")
      ).to eq true
    end
  end

  describe :schema_migrations_table_name do
    it "returns correct table name" do
      expect(subject.schema_migrations_table_name).to eq("data_migrations")
    end
  end

  describe :migrations_path do
    it "returns correct migrations path" do
      expect(subject.migrations_path).to eq("db/data")
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
data_migrate-3.2.2 spec/data_migrate/data_migrator_spec.rb
data_migrate-3.2.1 spec/data_migrate/data_migrator_spec.rb
data_migrate-3.2.0 spec/data_migrate/data_migrator_spec.rb
data_migrate-3.1.0 spec/data_migrate/data_migrator_spec.rb