Sha256: 9222a81b14b0f83cb2ee6ae710ee59e2eb759274dfbe44f95a54307d6d2d6680

Contents?: true

Size: 1.21 KB

Versions: 27

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe Blacklight::Gallery::OpenseadragonSolrDocument do
  subject { SolrDocument.new(fields).to_openseadragon(view_config) }

  context 'when configured for the view' do
    let(:fields) { { some_field: 'data' } }
    let(:view_config) { double('ViewConfig', tile_source_field: :some_field) }
    it 'returns the data from the document as an array' do
      expect(subject).to eq ['data']
    end
  end

  context 'when not configured for the view' do
    let(:fields) { { some_field: 'data' } }
    let(:view_config) { double('ViewConfig', tile_source_field: nil) }
    it 'returns nil' do
      expect(subject).to be_nil
    end
  end

  context 'when the document has the field' do
    let(:fields) { { some_field: 'data' } }
    let(:view_config) { double('ViewConfig', tile_source_field: :some_field) }
    it 'returns the data from the document as an array' do
      expect(subject).to eq ['data']
    end
  end

  context 'when the document does not have the field' do
    let(:fields) { { some_other_field: 'data' } }
    let(:view_config) { double('ViewConfig', tile_source_field: :some_field) }
    it 'returns the data from the document as an array' do
      expect(subject).to be_nil
    end
  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
blacklight-gallery-4.6.1 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-4.6.0 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-4.5.4 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-4.5.3 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-4.5.2 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-4.5.1 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-4.5.0 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-gallery-4.4.1/spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-4.4.1 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-4.4.0 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-4.3.0 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-4.2.0 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-4.1.0 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-4.0.2 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-4.0.1 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-4.0.0 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-3.5.0 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-3.4.0 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-3.3.1 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-3.3.0 spec/models/concerns/openseadragon_solr_document_spec.rb