Sha256: 4da0887ce83ac3d2216281e8e8cfb471202c4b0e5ca9c2eec63ec6584e812230

Contents?: true

Size: 1.13 KB

Versions: 22

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

describe Spotlight::Masthead, type: :model do
  let(:masthead) { stub_model(described_class) }

  describe '#iiif_url' do
    it 'inlcudes the appropriate size' do
      masthead.iiif_tilesource = 'http://example.com/iiif/abc123/info.json'
      expect(masthead.iiif_url).to match(%r{/full/1800,180/})
    end
  end

  describe '#display?' do
    subject { masthead.display? }

    let(:image) { OpenStruct.new }

    context 'when the masthead is set to not display' do
      it { is_expected.to be_falsey }
    end

    context 'when the cropped image is not present' do
      before { masthead.display = true }

      it { is_expected.to be_falsey }
    end

    context 'when the cropped image is present' do
      before do
        masthead.iiif_tilesource = 'http://test.host/images/1'
        masthead.iiif_region = '100,0,200,300'
      end

      context 'but the masthead is set to not display' do
        it { is_expected.to be_falsey }
      end

      context 'and the masthead is set to display' do
        before { masthead.display = true }

        it { is_expected.to be_truthy }
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

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