Sha256: 8a3b58a69e57295dea08838e1eedbaac1ee473754f71bf80ee57fd9401f6d112

Contents?: true

Size: 1.14 KB

Versions: 6

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'

describe GeoWorks::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

6 entries across 6 versions & 1 rubygems

Version Path
geo_works-0.2.0 spec/services/geo_works/discovery/document_builder/basic_metadata_builder_spec.rb
geo_works-0.1.4 spec/services/geo_works/discovery/document_builder/basic_metadata_builder_spec.rb
geo_works-0.1.3 spec/services/geo_works/discovery/document_builder/basic_metadata_builder_spec.rb
geo_works-0.1.2 spec/services/geo_works/discovery/document_builder/basic_metadata_builder_spec.rb
geo_works-0.1.1 spec/services/geo_works/discovery/document_builder/basic_metadata_builder_spec.rb
geo_works-0.1.0 spec/services/geo_works/discovery/document_builder/basic_metadata_builder_spec.rb