Sha256: 6119f5910b625b7468957e8f8b597c6cb6b3b78c272dd0ed4da54df6a35c525a

Contents?: true

Size: 1.03 KB

Versions: 10

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

require "spec_helper"

describe DataMigrate::SchemaDumper do
  let(:subject) { DataMigrate::SchemaDumper }
  let(:fixture_file_timestamps) do
    %w[20091231235959 20101231235959 20111231235959]
  end

  before do
    DataMigrate::RailsHelper.schema_migration.create_table
    DataMigrate::RailsHelper.data_schema_migration.create_table

    fixture_file_timestamps.map do |t|
      DataMigrate::RailsHelper.data_schema_migration.create_version(t)
    end
  end

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

  describe ".dump" do
    it "writes the define method with the version key to the stream" do
      stream = StringIO.new
      DataMigrate::SchemaDumper.dump(ActiveRecord::Base.connection, stream)
      stream.rewind

      last_version = fixture_file_timestamps.last
      expected = "DataMigrate::Data.define(version: #{last_version})"
      expect(stream.read).to include expected
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
data_migrate-11.1.0 spec/data_migrate/schema_dumper_spec.rb
data_migrate-11.0.0 spec/data_migrate/schema_dumper_spec.rb
data_migrate-11.0.0.rc3 spec/data_migrate/schema_dumper_spec.rb
data_migrate-11.0.0.rc spec/data_migrate/schema_dumper_spec.rb
data_migrate-9.4.4 spec/data_migrate/schema_dumper_spec.rb
data_migrate-9.4.2 spec/data_migrate/schema_dumper_spec.rb
data_migrate-9.4.1 spec/data_migrate/schema_dumper_spec.rb
data_migrate-9.4.0 spec/data_migrate/schema_dumper_spec.rb
data_migrate-9.3.0 spec/data_migrate/schema_dumper_spec.rb
data_migrate-9.2.0 spec/data_migrate/schema_dumper_spec.rb