Sha256: b6cb83a577eef2bfbdc1a4bb4d7488878540475476efb662ea8bf6de9063d0c6
Contents?: true
Size: 1.98 KB
Versions: 14
Compression:
Stored size: 1.98 KB
Contents
require 'spec_helper' describe Geoblacklight::MetadataTransformer do let(:klass) { instance_double(Class) } before do allow(metadata).to receive(:blank?).and_return(false) allow(metadata).to receive(:class).and_return(klass) end describe '.instance' do context 'with FGDC metadata' do let(:metadata) { instance_double(Geoblacklight::Metadata::Fgdc) } subject do described_class.instance(metadata) end before do allow(klass).to receive(:name).and_return('Geoblacklight::Metadata::Fgdc') end it 'initializes a Fgdc Object' do expect(subject).to be_a Geoblacklight::MetadataTransformer::Fgdc end end context 'with ISO19139 metadata' do let(:metadata) { instance_double(Geoblacklight::Metadata::Iso19139) } subject do described_class.instance(metadata) end before do allow(klass).to receive(:name).and_return('Geoblacklight::Metadata::Iso19139') end it 'initializes a Iso19139 Object' do expect(subject).to be_a Geoblacklight::MetadataTransformer::Iso19139 end end context 'without a metadata type' do let(:metadata) { instance_double(Geoblacklight::Metadata::Base) } subject do described_class.instance(metadata) end before do allow(klass).to receive(:name).and_return('Geoblacklight::Metadata::Base') end it 'defaults to the BaseTransformer Class' do expect(subject).to be_a Geoblacklight::MetadataTransformer::Base end end context 'with an invalid metadata type' do let(:metadata) { instance_double(Geoblacklight::Metadata::Base) } before do allow(klass).to receive(:name).and_return('Geoblacklight::Metadata::Invalid') end it 'raises a TypeError' do expect { described_class.instance(metadata) }.to \ raise_error Geoblacklight::MetadataTransformer::TypeError, /Metadata type .+ is not supported/ end end end end
Version data entries
14 entries across 14 versions & 1 rubygems