Sha256: 73a78f634ff4d3bb5577e5d47c9083777ac13b5579922751a8430fca44b332ab
Contents?: true
Size: 1.02 KB
Versions: 16
Compression:
Stored size: 1.02 KB
Contents
require 'test_helper' describe "Traject::Indexer::Context" do describe "source_record_id" do before do @record = MARC::Reader.new(support_file_path('test_data.utf8.mrc')).first @context = Traject::Indexer::Context.new @record_001 = " 00282214 " # from the mrc file end it "gets it from 001" do @context.source_record = @record assert_equal @record_001, @context.source_record_id end it "gets it from the id" do @context.output_hash['id'] = 'the_record_id' assert_equal 'the_record_id', @context.source_record_id end it "gets from the id with non-MARC source" do @context.source_record = Object.new @context.output_hash['id'] = 'the_record_id' assert_equal 'the_record_id', @context.source_record_id end it "gets it from both 001 and id" do @context.output_hash['id'] = 'the_record_id' @context.source_record = @record assert_equal [@record_001, 'the_record_id'].join('/'), @context.source_record_id end end end
Version data entries
16 entries across 16 versions & 1 rubygems