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-3.2.0 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-3.1.0 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-3.0.4 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-3.0.3 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-3.0.2 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-3.0.1 spec/models/concerns/openseadragon_solr_document_spec.rb
blacklight-gallery-3.0.0 spec/models/concerns/openseadragon_solr_document_spec.rb