Sha256: 1da77ad00502be86f4cd5ca3c9fb37784b22728ac05245d9da2d2941d8692959

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

module Ddr::IngestTools::DdrRdrMigrator

  RSpec.describe ColumnRenamer do

    subject do
      described_class.new(manifest: manifest)
    end

    let(:ddr_headers) do
      [ 'title', 'alternative', 'creator', 'contributor', 'affiliation', 'publisher', 'date', 'temporal',
        'description', 'subject', 'spatial', 'language', 'type', 'format', 'relation', 'rights',
        'provenance', 'citation', 'permanent_id', 'doi' ]
    end
    let(:rdr_headers) do
      [ 'title', 'alternative', 'creator', 'contributor', 'affiliation', 'publisher', 'available', 'temporal',
        'description', 'subject', 'based_near', 'language', 'resource_type', 'format', 'related_url', 'license',
        'provenance', 'bibliographic_citation', 'ark', 'doi' ]
    end
    let(:data) do
      [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't' ]
    end
    let(:manifest) { CSV::Table.new([ CSV::Row.new(ddr_headers, data) ]) }
    let(:expected_manifest) { CSV::Table.new([ CSV::Row.new(rdr_headers, data) ]) }

    it 'renames the appropriate manifest columns' do
      expect(subject.call).to eq(expected_manifest)
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ddr-ingesttools-0.5.0.rc2 spec/ddr_rdr_migrator/column_renamer_spec.rb
ddr-ingesttools-0.5.0.rc1 spec/ddr_rdr_migrator/column_renamer_spec.rb