Sha256: 01eef3b42ea9d20a637b4e97e2043d9581b9b7fc97e57bb3a99166ddef01f555

Contents?: true

Size: 1.1 KB

Versions: 9

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

9 entries across 9 versions & 1 rubygems

Version Path
blacklight-spotlight-2.4.1 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-2.4.0 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-2.3.3 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-2.3.2 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-2.3.1 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-2.3.0 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-2.2.1 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-2.2.0 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-2.1.0 spec/models/spotlight/masthead_spec.rb