Sha256: 004004606f7dbe2b57bd23a8eb647d7f6abb8aa7a20e79049b0329f3045ca77c

Contents?: true

Size: 1.43 KB

Versions: 20

Compression:

Stored size: 1.43 KB

Contents

# frozen_string_literal: true
require 'spec_helper'

describe Geoblacklight::Metadata do
  describe '.instance' do
    let(:reference) { instance_double(Geoblacklight::Reference) }
    context 'with an FGDC metadata reference' do
      before do
        allow(reference).to receive(:type).and_return('fgdc')
      end
      it 'constructs an Geoblacklight::Metadata::Fgdc instance' do
        expect(described_class.instance(reference)).to be_a Geoblacklight::Metadata::Fgdc
      end
    end

    context 'with an ISO19139 metadata reference' do
      before do
        allow(reference).to receive(:type).and_return('iso19139')
      end
      it 'constructs an Geoblacklight::Metadata::Iso19139 instance' do
        expect(described_class.instance(reference)).to be_a Geoblacklight::Metadata::Iso19139
      end
    end

    context 'with an html metadata reference' do
      before do
        allow(reference).to receive(:type).and_return('html')
      end
      it 'constructs an Geoblacklight::Metadata::Html instance' do
        expect(described_class.instance(reference)).to be_a Geoblacklight::Metadata::Html
      end
    end

    context 'with another metadata reference' do
      before do
        allow(reference).to receive(:type).and_return('unsupported')
      end
      it 'constructs an Geoblacklight::Metadata::Base instance' do
        expect(described_class.instance(reference)).to be_a Geoblacklight::Metadata::Base
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
geoblacklight-3.8.1 spec/lib/geoblacklight/metadata_spec.rb
geoblacklight-3.8.0 spec/lib/geoblacklight/metadata_spec.rb
geoblacklight-4.0.0 spec/lib/geoblacklight/metadata_spec.rb
geoblacklight-4.0.0.pre.rc3 spec/lib/geoblacklight/metadata_spec.rb
geoblacklight-3.7.0 spec/lib/geoblacklight/metadata_spec.rb
geoblacklight-4.0.0.pre.rc2 spec/lib/geoblacklight/metadata_spec.rb
geoblacklight-4.0.0.pre.rc1 spec/lib/geoblacklight/metadata_spec.rb
geoblacklight-3.6.0 spec/lib/geoblacklight/metadata_spec.rb
geoblacklight-3.5.0 spec/lib/geoblacklight/metadata_spec.rb
geoblacklight-4.0.0.pre.alpha.3 spec/lib/geoblacklight/metadata_spec.rb
geoblacklight-4.0.0.pre.alpha.2 spec/lib/geoblacklight/metadata_spec.rb
geoblacklight-4.0.0.pre.alpha.1 spec/lib/geoblacklight/metadata_spec.rb
geoblacklight-4.0.0.pre.alpha spec/lib/geoblacklight/metadata_spec.rb
geoblacklight-3.4.0 spec/lib/geoblacklight/metadata_spec.rb
geoblacklight-3.3.1 spec/lib/geoblacklight/metadata_spec.rb
geoblacklight-3.3.0 spec/lib/geoblacklight/metadata_spec.rb
geoblacklight-3.2.0 spec/lib/geoblacklight/metadata_spec.rb
geoblacklight-3.1.0 spec/lib/geoblacklight/metadata_spec.rb
geoblacklight-3.0.1 spec/lib/geoblacklight/metadata_spec.rb
geoblacklight-3.0.0 spec/lib/geoblacklight/metadata_spec.rb