Sha256: 11356e2bf12f4e63b42e4c93a101967b78d6fb36510bbec453ddce34e8fc61e9

Contents?: true

Size: 1.48 KB

Versions: 22

Compression:

Stored size: 1.48 KB

Contents

# frozen_string_literal: true

describe Spotlight::SolrDocument::UploadedResource, type: :model do
  let(:valid_resource) do
    SolrDocument.new(id: '123',
                     full_image_url_ssm: ['http://example.com/png.png'],
                     spotlight_full_image_height_ssm: ['1400'],
                     spotlight_full_image_width_ssm: ['1000'],
                     spotlight_resource_type_ssim: ['spotlight/resources/uploads'])
  end

  describe 'SolrDocument.use_extension' do
    it 'does not include the uploaded resource extension when the spotlight resource type is not correct' do
      expect(SolrDocument.new(id: '123', spotlight_resource_type_ssim: ['not-correct'])).not_to be_a_kind_of(described_class)
    end

    it 'includes the uploaded resource extension when the correct fields are present with the correct data' do
      expect(valid_resource).to be_a_kind_of(described_class)
    end
  end

  describe 'to_openseadragon' do
    subject(:osd) { valid_resource.to_openseadragon }

    let(:uploaded_resource) { instance_double(Spotlight::Resources::Upload, upload: upload) }
    let(:upload) { instance_double(Spotlight::FeaturedImage, iiif_tilesource: '/whatever/info.json') }

    before do
      allow(valid_resource).to receive(:uploaded_resource).and_return(uploaded_resource)
    end

    it 'includes hashes for each full_image_url_ssm' do
      expect(osd).to be_an Array
      expect(osd.length).to eq 1
      expect(osd.first).to end_with '/whatever/info.json'
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
blacklight-spotlight-3.4.0 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-3.3.0 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-3.2.0 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-3.1.0 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-3.0.3 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-3.0.2 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-3.0.1 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-3.0.0 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-3.0.0.rc6 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-3.0.0.rc5 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-3.0.0.rc4 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-3.0.0.rc3 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-3.0.0.rc2 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-3.0.0.rc1 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-3.0.0.alpha.10 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-3.0.0.alpha.9 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-3.0.0.alpha.8 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-3.0.0.alpha.7 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-3.0.0.alpha.6 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-3.0.0.alpha.5 spec/models/spotlight/solr_document/uploaded_resource_spec.rb