Sha256: ffb869942016a602d9a11668c5b66add40d77ee070caed2470f617a4a5b7d5d5

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

RSpec.describe "catalog/_document" do
  let(:document) { SolrDocument.new id: 'xyz', format: 'a' }
  let(:blacklight_config) { Blacklight::Configuration.new }

  before do
    allow(controller).to receive(:controller_name).and_return('test')
    allow(view).to receive(:render_grouped_response?).and_return(false)
    allow(view).to receive(:blacklight_config).and_return(blacklight_config)
    allow(view).to receive(:search_session).and_return({})
    allow(view).to receive(:current_search_session).and_return(nil)
    allow(view.main_app).to receive(:track_test_path).and_return('/track')
    assign(:response, instance_double(Blacklight::Solr::Response, start: 20))
  end

  it "uses the index.partials parameter to determine the partials to render" do
    blacklight_config.index.partials = %w[a b c]
    stub_template "catalog/_a_default.html.erb" => "a_partial"
    stub_template "catalog/_b_default.html.erb" => "b_partial"
    stub_template "catalog/_c_default.html.erb" => "c_partial"
    render partial: "catalog/document", locals: { document: document, document_counter: 1 }
    expect(rendered).to match /a_partial/
    expect(rendered).to match /b_partial/
    expect(rendered).to match /c_partial/
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
blacklight-8.0.0.beta4 spec/views/catalog/_document.html.erb_spec.rb
blacklight-8.0.0.beta3 spec/views/catalog/_document.html.erb_spec.rb
blacklight-8.0.0.beta2 spec/views/catalog/_document.html.erb_spec.rb
blacklight-8.0.0.beta1 spec/views/catalog/_document.html.erb_spec.rb