Sha256: 6f3249d4d797fe0934f39526d9c8782a2db16de5c6f75aa23fdbdad9b6504d19

Contents?: true

Size: 744 Bytes

Versions: 1

Compression:

Stored size: 744 Bytes

Contents

require 'ezid/batch_enumerator'

module Ezid
  RSpec.describe BatchEnumerator do

    let(:batch_file) { File.expand_path("../../fixtures/anvl_batch.txt", __FILE__) }

    subject { described_class.new(:anvl, batch_file) }

    its(:count) { is_expected.to eq 4 }

    specify {
      subject.each do |id|
        expect(id).to be_a(Identifier)
      end
    }

    specify {
      batch_array = subject.to_a
      expect(batch_array.length).to eq 4
    }

    specify {
      ids = subject.map(&:id)
      expect(ids).to eq ["ark:/99999/fk4086hs23", "ark:/99999/fk4086hs23/123", "ark:/99999/fk40p1bb85", "ark:/99999/fk40z7fh7x"]
    }

    specify {
      id = subject.first
      expect(id.target).to eq "http://example.com"
    }

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ezid-client-1.6.0 spec/unit/batch_enumerator_spec.rb