test/indexer/macros_marc21_test.rb in traject-0.13.1 vs test/indexer/macros_marc21_test.rb in traject-0.13.2

- old
+ new

@@ -54,10 +54,30 @@ end output = @indexer.map_record(@record) assert_equal ["DEFAULT VALUE"], output["only_default"] end + + it "respects the :deduplicate option (and its alias 'uniq')" do + # Add a second 008 + f = @record.fields('008').first + @record.append(f) + + @indexer.instance_eval do + to_field "lang1", extract_marc('008[35-37]') + to_field "lang2", extract_marc('008[35-37]', :deduplicate=>true) + to_field "lang3", extract_marc('008[35-37]', :uniq=>true) + end + + output = @indexer.map_record(@record) + assert_equal ["eng", "eng"], output['lang1'] + assert_equal ["eng"], output['lang2'] + assert_equal ["eng"], output['lang3'] + + end + + it "Marc21::trim_punctuation class method" do assert_equal "one two three", Marc21.trim_punctuation("one two three") assert_equal "one two three", Marc21.trim_punctuation("one two three,") @@ -73,10 +93,10 @@ assert_equal "one two three", Marc21.trim_punctuation("[one two three]") end it "uses :translation_map" do @indexer.instance_eval do - to_field "cataloging_agency", extract_marc("040a", :seperator => nil, :translation_map => "marc_040a_translate_test") + to_field "cataloging_agency", extract_marc("040a", :separator => nil, :translation_map => "marc_040a_translate_test") end output = @indexer.map_record(@record) assert_equal ["Library of Congress"], output["cataloging_agency"] end \ No newline at end of file