Sha256: 279a2ba1a18b63409c9a7a2e252ceb151ef2768174bcc2f622bbcff9adaac835
Contents?: true
Size: 1.29 KB
Versions: 4
Compression:
Stored size: 1.29 KB
Contents
require 'spec_helper' require 'marc' module BerkeleyLibrary module TIND module Mapping describe AdditionalDatafieldProcess do let(:qualified_alma_obj) { Alma.new('spec/data/mapping/record.xml') } let(:qualified_alm_record) { qualified_alma_obj.record } let(:tind_marc) { TindMarc.new(qualified_alm_record) } let(:tindfields) { tind_marc.tindfields } let(:additona_245_field) { [Util.datafield('245', [' ', ' '], [Util.subfield('a', 'fake 245 a')])] } let(:with_repeated_fields) { tindfields.concat additona_245_field } context '# Process 1: Remove duplicated fields' do # two 245 fields inputed, one is removed it 'Input two 245 fields, return only one 245 field' do expect(tind_marc.remove_repeats(with_repeated_fields).map(&:tag).count('245')).to eq 1 end # one subfield 'a' is kept, subfield 'a' with a value of 'fake 245 a' is ignored it 'Input two subfield $a, keeping the first one' do without_repeated_fields = tind_marc.remove_repeats(with_repeated_fields) single_field_245 = tind_marc.field_on_tag('245', without_repeated_fields) expect(single_field_245['a']).to eq 'Cang jie pian' end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems