Sha256: 3540f2c150e7112294239cab71a7454971e5eaf607db67ca6119dc29513913ad

Contents?: true

Size: 1 KB

Versions: 27

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'

describe Spotlight::Masthead, type: :model do
  describe '#masthead_exists?' do
    let(:masthead) { stub_model(described_class) }
    let(:image) { OpenStruct.new }
    it 'returns false when the masthead is set to not display' do
      expect(masthead.display?).to be_falsey
    end
    it 'returns false when the cropped image is not present' do
      masthead.display = true
      expect(masthead.display?).to be_falsey
    end
    it 'returns false when the cropped image is present but the masthead is set to not display' do
      allow(masthead).to receive(:image).and_return(image)
      allow(image).to receive(:cropped).and_return([0])
      expect(masthead.display?).to be_falsey
    end
    it 'returns true when the cropped image is present and the masthead is set to display' do
      masthead.display = true
      expect(masthead).to receive(:image).and_return(image)
      expect(image).to receive(:cropped).and_return([0])
      expect(masthead.display?).to be_truthy
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
blacklight-spotlight-0.8.1 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-0.8.0 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-0.7.2 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-0.7.1 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-0.7.0 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-0.6.0 spec/models/spotlight/masthead_spec.rb
blacklight-spotlight-0.5.0 spec/models/spotlight/masthead_spec.rb