Sha256: b70d2c1318c2b9746504fd5ee6e8adef8719a454b4b546f5f9fd9bb2c709738a

Contents?: true

Size: 961 Bytes

Versions: 7

Compression:

Stored size: 961 Bytes

Contents

# frozen_string_literal: true

# spec for sidebar partial in catalog show view

RSpec.describe "catalog/_show_sidebar.html.erb" do
  let(:blacklight_config) do
    Blacklight::Configuration.new do |config|
      config.index.title_field = 'title_tsim'
      config.index.sidebar_component = Blacklight::Document::SidebarComponent
    end
  end

  before do
    allow(view).to receive_messages(blacklight_config: blacklight_config, has_user_authentication_provider?: false, document_actions: [], session_tracking_params: {})
  end

  it "shows more-like-this titles in the sidebar" do
    document = SolrDocument.new id: 1, title_s: 'abc', format: 'default'
    allow(document).to receive(:more_like_this).and_return([SolrDocument.new('id' => '2', 'title_tsim' => 'Title of MLT Document')])
    render 'catalog/show_sidebar', document: document
    expect(rendered).to include("More Like This")
    expect(rendered).to include("Title of MLT Document")
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
blacklight-8.6.1 spec/views/catalog/_show_sidebar.erb_spec.rb
blacklight-8.6.0 spec/views/catalog/_show_sidebar.erb_spec.rb
blacklight-8.5.1 spec/views/catalog/_show_sidebar.erb_spec.rb
blacklight-8.5.0 spec/views/catalog/_show_sidebar.erb_spec.rb
blacklight-8.4.0 spec/views/catalog/_show_sidebar.erb_spec.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-8.3.0/spec/views/catalog/_show_sidebar.erb_spec.rb
blacklight-8.3.0 spec/views/catalog/_show_sidebar.erb_spec.rb