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

Version Path
traject-2.3.4-java test/indexer/context_test.rb
traject-2.3.4 test/indexer/context_test.rb
traject-2.3.3 test/indexer/context_test.rb
traject-2.3.3-java test/indexer/context_test.rb
traject-2.3.2-java test/indexer/context_test.rb
traject-2.3.2 test/indexer/context_test.rb
traject-2.3.1-java test/indexer/context_test.rb
traject-2.3.1 test/indexer/context_test.rb
traject-2.3.0-java test/indexer/context_test.rb
traject-2.3.0 test/indexer/context_test.rb
traject-2.2.1-java test/indexer/context_test.rb
traject-2.2.1 test/indexer/context_test.rb
traject-2.2.0 test/indexer/context_test.rb
traject-2.2.0-java test/indexer/context_test.rb
traject-2.1.0-java test/indexer/context_test.rb
traject-2.1.0 test/indexer/context_test.rb