Sha256: 2a2c1ceaa793244680c6531daad95fe5b20b6b07506865e6c396a63882af6f28

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'
require 'tempfile'

module Ddr::IngestTools::DdrRdrMigrator

  RSpec.describe FilePathAdder do

    subject do
      described_class.new(checksum_file: checksum_file, files: files, manifest: manifest)
    end

    let(:files) { File.join('spec', 'fixtures', 'ddr_rdr_migrator', 'source', 'changeme-664',
                            'changeme-664-export-file') }
    let(:manifest_file) { File.join('spec', 'fixtures', 'ddr_rdr_migrator', 'manifests', 'sorted_manifest.csv') }
    let(:manifest) { CSV.read(manifest_file, headers: true) }
    let(:expected_manifest_file) { File.join('spec', 'fixtures', 'ddr_rdr_migrator', 'manifests',
                                             'sorted_manifest_with_file_paths.csv') }
    let(:expected_manifest) { CSV.read(expected_manifest_file, headers: true) }
    let(:outdir) { Dir.mktmpdir }
    let(:checksum_file) { File.join(outdir, 'checksums.txt') }
    let(:expected_checksum_file) { File.join('spec', 'fixtures', 'ddr_rdr_migrator', 'target', 'changeme-664',
                                             'checksums.txt') }

    after { FileUtils.remove_dir outdir }

    it 'adds the appropriate file paths to the manifest' do
      expect(subject.call).to eq(expected_manifest)
    end

    it 'creates a checksum file' do
      subject.call
      expect(File.read(checksum_file)).to eq(File.read(expected_checksum_file))
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ddr-ingesttools-0.6.1 spec/ddr_rdr_migrator/file_path_adder_spec.rb
ddr-ingesttools-0.6.0 spec/ddr_rdr_migrator/file_path_adder_spec.rb