Sha256: 7538263fa5af4053a8eb26013a589717882ed99f482eef3604e0401914824cb5

Contents?: true

Size: 1.23 KB

Versions: 24

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

describe Geoblacklight::ItemViewer do
  let(:document) { SolrDocument.new(document_attributes) }
  let(:document_attributes) { {} }
  let(:references) { document.references }
  let(:item_viewer) { Geoblacklight::ItemViewer.new(references) }
  describe 'viewer_preference' do
    describe 'for no references' do
      it 'returns nil' do
        expect(item_viewer.viewer_preference).to be_nil
      end
    end
    describe 'for wms reference' do
      let(:document_attributes) {
        {
          dct_references_s: {
            'http://www.opengis.net/def/serviceType/ogc/wms' => 'http://www.example.com/wms',
            'http://iiif.io/api/image' => 'http://www.example.com/iiif'
          }.to_json
        }
      }
      it 'wms if wms is present' do
        expect(item_viewer.viewer_preference).to eq wms: 'http://www.example.com/wms'
      end
    end
    describe 'for iiif only reference' do
      let(:document_attributes) {
        {
          dct_references_s: {
            'http://iiif.io/api/image' => 'http://www.example.com/iiif'
          }.to_json
        }
      }
      it 'returns iiif' do
        expect(item_viewer.viewer_preference).to eq iiif: 'http://www.example.com/iiif'
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
geoblacklight-0.11.1 spec/lib/geoblacklight/item_viewer_spec.rb
geoblacklight-0.11.0 spec/lib/geoblacklight/item_viewer_spec.rb
geoblacklight-0.10.2 spec/lib/geoblacklight/item_viewer_spec.rb
geoblacklight-0.10.1 spec/lib/geoblacklight/item_viewer_spec.rb
geoblacklight-0.10.0 spec/lib/geoblacklight/item_viewer_spec.rb
geoblacklight-0.9.2 spec/lib/geoblacklight/item_viewer_spec.rb
geoblacklight-0.9.1 spec/lib/geoblacklight/item_viewer_spec.rb
geoblacklight-0.9.0 spec/lib/geoblacklight/item_viewer_spec.rb
geoblacklight-0.8.0 spec/lib/geoblacklight/item_viewer_spec.rb
geoblacklight-0.7.1 spec/lib/geoblacklight/item_viewer_spec.rb
geoblacklight-0.7.0 spec/lib/geoblacklight/item_viewer_spec.rb
geoblacklight-0.6.2 spec/lib/geoblacklight/item_viewer_spec.rb
geoblacklight-0.6.1 spec/lib/geoblacklight/item_viewer_spec.rb
geoblacklight-0.6.0 spec/lib/geoblacklight/item_viewer_spec.rb
geoblacklight-0.5.1 spec/lib/geoblacklight/item_viewer_spec.rb
geoblacklight-0.5.0 spec/lib/geoblacklight/item_viewer_spec.rb
geoblacklight-0.4.2 spec/lib/geoblacklight/item_viewer_spec.rb
geoblacklight-0.4.1 spec/lib/geoblacklight/item_viewer_spec.rb
geoblacklight-0.4.0 spec/lib/geoblacklight/item_viewer_spec.rb
geoblacklight-0.3.4 spec/lib/geoblacklight/item_viewer_spec.rb