Sha256: 19c2170f0178298c110d50403de97e33ba446c97c12d913383c9e4a104e853d6

Contents?: true

Size: 967 Bytes

Versions: 2

Compression:

Stored size: 967 Bytes

Contents

# frozen_string_literal: true

describe 'spotlight/browse/search', type: :view do
  let(:search) { FactoryBot.create(:search) }
  let(:exhibit) { FactoryBot.create(:exhibit) }
  before do
    allow(search).to receive_messages(documents: double(size: 15))
    allow(search).to receive_message_chain(:thumbnail, iiif_url: '/some/image')
  end

  before do
    assign :exhibit, exhibit
  end

  it 'displays the image' do
    render partial: 'spotlight/browse/search', locals: { search: search }
    expect(response).to have_selector 'a img[src="/some/image"]'
  end

  it 'has a heading' do
    render partial: 'spotlight/browse/search', locals: { search: search }
    expect(response).to have_link search.title, href: spotlight.exhibit_browse_path(exhibit, search)
  end

  it 'displays the item count' do
    render partial: 'spotlight/browse/search', locals: { search: search }
    expect(response).to have_selector 'small', text: /#{search.count} items/i
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
blacklight-spotlight-3.0.0.alpha.2 spec/views/spotlight/browse/_search.html.erb_spec.rb
blacklight-spotlight-3.0.0.alpha.1 spec/views/spotlight/browse/_search.html.erb_spec.rb