Sha256: 5ca5d5b05d68742090077df9ea18f30df1de783d809038030931b7aba25a517f

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

describe 'spotlight/browse/search', :type => :view do
  let(:search) { FactoryGirl.create(:search) }
  let(:exhibit) { FactoryGirl.create(:exhibit) }
  before :each do
    allow(search).to receive_messages(count: 15)
  end

  before :each do
    assign :exhibit, exhibit
  end

  it "should display the image" do
    allow(search).to receive_messages(featured_image: "xyz")
    render partial: 'spotlight/browse/search', locals: { search: search }
    expect(response).to have_selector 'a img'
  end

  it "should have 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 "should display the item count" do
    render partial: 'spotlight/browse/search', locals: { search: search }
    expect(response).to have_selector ".item-count", text: "#{search.count} items"
  end

  it "should display the short description" do
    allow(search).to receive_messages(short_description: "Short description")
    render partial: 'spotlight/browse/search', locals: { search: search }
    expect(response).to have_selector "p", text: search.short_description
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
blacklight-spotlight-0.3.1 spec/views/spotlight/browse/_search.html.erb_spec.rb
blacklight-spotlight-0.3.0 spec/views/spotlight/browse/_search.html.erb_spec.rb
blacklight-spotlight-0.2.0 spec/views/spotlight/browse/_search.html.erb_spec.rb