Sha256: fe4bfe793fa8e88eb0aa510e64f027e1268ac9377497ff2ada30a46afcd5aaf7

Contents?: true

Size: 1.1 KB

Versions: 24

Compression:

Stored size: 1.1 KB

Contents

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
    let(:image) { OpenStruct.new }
    subject { masthead.display? }

    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

24 entries across 24 versions & 1 rubygems

Version Path
blacklight-spotlight-2.0.2 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-2.0.1 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-2.0.0 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-2.0.0.rc6 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-2.0.0.rc5 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-2.0.0.rc4 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-2.0.0.rc3 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-2.0.0.rc2 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-2.0.0.rc1 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-1.5.1 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-1.4.1 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-1.4.0 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-1.3.0 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-1.2.0 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-1.1.0 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-1.0.0 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-1.0.0.alpha2 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-1.0.0.alpha1 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-0.34.1 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-0.34.0 spec/models/spotlight/masthead_spec.rb