Sha256: 9cff555613386c133cc3bea4c3176d2e67ad1ec156abf14c6966d72de77b13eb

Contents?: true

Size: 1.91 KB

Versions: 6

Compression:

Stored size: 1.91 KB

Contents

require 'spec_helper'

module Ddr::IngestTools::DdrRdrMigrator

  RSpec.describe WorkNester do

    subject { described_class.new(manifest: manifest) }

    let(:ddr_headers) do
      %w[
          pid model title alternative creator contributor affiliation publisher available temporal description
          subject based_near language resource_type format related_url provenance bibliographic_citation
          ark doi license
        ]
    end
    let(:rdr_headers) do
      %w[
          pid model title alternative creator contributor affiliation publisher available temporal description
          subject based_near language resource_type format related_url provenance bibliographic_citation
          ark doi license parent_ark
        ]
    end
    let(:ddr_data) do
      [  %w[ test:1 Collection a b c d e f g h i j k l m n o p q r s t ],
         %w[ test:2 Item aa ab ac ad ae af ag ah ai aj ak al am an ao ap aq ar as at ],
         %w[ test:3 Item ba bb bc bd be bf bg bh bi bj bk bl bm bn bo bp bq br bs bt ]
      ]
    end
    let(:rdr_data) do
      [  %w[ test:1 Collection a b c d e f g h i j k l m n o p q r s t ],
         %w[ test:2 Item aa ab ac ad ae af ag ah ai aj ak al am an ao ap aq ar as at r ],
         %w[ test:3 Item ba bb bc bd be bf bg bh bi bj bk bl bm bn bo bp bq br bs bt r ]
      ]
    end
    let(:manifest) do
      CSV::Table.new([ CSV::Row.new(ddr_headers, ddr_data[0]),
                       CSV::Row.new(ddr_headers, ddr_data[1]),
                       CSV::Row.new(ddr_headers, ddr_data[2])
                     ])
    end
    let(:expected_manifest) do
      CSV::Table.new([ CSV::Row.new(rdr_headers, rdr_data[0]),
                       CSV::Row.new(rdr_headers, rdr_data[1]),
                       CSV::Row.new(rdr_headers, rdr_data[2])
                     ])
    end

    it 'adds and populates the parent ark column' do
      expect(subject.call).to eq(expected_manifest)
    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ddr-ingesttools-0.6.1 spec/ddr_rdr_migrator/work_nester_spec.rb
ddr-ingesttools-0.6.0 spec/ddr_rdr_migrator/work_nester_spec.rb
ddr-ingesttools-0.5.0 spec/ddr_rdr_migrator/work_nester_spec.rb
ddr-ingesttools-0.5.0.rc3 spec/ddr_rdr_migrator/work_nester_spec.rb
ddr-ingesttools-0.5.0.rc2 spec/ddr_rdr_migrator/work_nester_spec.rb
ddr-ingesttools-0.5.0.rc1 spec/ddr_rdr_migrator/work_nester_spec.rb