Sha256: 39fe174f251d4f94882deec5e2b469873ea7bd05e521bc5d3ac5b6e010582443

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

describe GeoConcerns::Discovery::DocumentBuilder::BasicMetadataBuilder do
  subject { described_class.new(geo_concern) }

  let(:geo_concern) { FactoryGirl.build(:public_vector_work, id: 'geo-work-1') }
  let(:id_string) { 'ark:/99999/fk4' }

  describe '#identifier' do
    context 'nil' do
      it 'returns the geo_concern id' do
        allow(geo_concern).to receive(:identifier).and_return(nil)
        expect(subject.send(:identifier)).to eq 'geo-work-1'
      end
    end
    context 'String' do
      it 'returns the identifier string' do
        allow(geo_concern).to receive(:identifier).and_return(id_string)
        expect(subject.send(:identifier)).to eq id_string
      end
    end
    context 'empty array' do
      it 'returns the geo_concern id' do
        allow(geo_concern).to receive(:identifier).and_return([])
        expect(subject.send(:identifier)).to eq 'geo-work-1'
      end
    end
    context 'array with String' do
      it 'returns the identifier string' do
        allow(geo_concern).to receive(:identifier).and_return([id_string])
        expect(subject.send(:identifier)).to eq id_string
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
geo_concerns-0.3.4 spec/services/geo_concerns/discovery/document_builder/basic_metadata_builder_spec.rb
geo_concerns-0.3.3 spec/services/geo_concerns/discovery/document_builder/basic_metadata_builder_spec.rb
geo_concerns-0.3.2 spec/services/geo_concerns/discovery/document_builder/basic_metadata_builder_spec.rb
geo_concerns-0.3.1 spec/services/geo_concerns/discovery/document_builder/basic_metadata_builder_spec.rb