Sha256: f8c3d8e7ebd3514f7d8b130ea2c26d255b1064fdb1b1ab91dcfde611cc634615

Contents?: true

Size: 1.48 KB

Versions: 18

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'])).to_not 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

18 entries across 18 versions & 1 rubygems

Version Path
blacklight-spotlight-3.0.0.alpha.2 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-3.0.0.alpha.1 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-2.13.0 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-2.12.1 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-2.12.0 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-2.11.0 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-2.10.0 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-2.9.0 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-2.8.0 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-2.7.2 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-2.7.1 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-2.7.0 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-2.6.1.1 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-2.6.1 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-2.6.0 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-2.5.2 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-2.5.1 spec/models/spotlight/solr_document/uploaded_resource_spec.rb
blacklight-spotlight-2.5.0 spec/models/spotlight/solr_document/uploaded_resource_spec.rb