Sha256: 617ce24b0893aa7c9e3db540b65b84f77308aebe41bdf3ca696256e78403e02e

Contents?: true

Size: 1.18 KB

Versions: 7

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

RSpec.describe "catalog/index.html.erb" do
  describe "with no search parameters" do
    before do
      allow(view).to receive(:has_search_parameters?).and_return(false)
      allow(view).to receive(:blacklight_config).and_return(Blacklight::Configuration.new)
    end

    let(:sidebar) { view.content_for(:sidebar) }

    it "renders the search_sidebar partial" do
      stub_template "catalog/_search_sidebar.html.erb" => "sidebar_content"
      render
      expect(sidebar).to match /sidebar_content/
    end
  end

  describe "with search parameters" do
    before do
      allow(view).to receive(:has_search_parameters?).and_return(true)
      stub_template "catalog/_results_pagination.html.erb" => ""
      stub_template "catalog/_search_header.html.erb" => "header_content"
      allow(view).to receive(:blacklight_config).and_return(Blacklight::Configuration.new)
      allow(view).to receive(:render_opensearch_response_metadata).and_return("")
      assign(:response, instance_double(Blacklight::Solr::Response, empty?: true))
    end

    it "renders the search_header partial" do
      render
      expect(rendered).to match /header_content/
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
blacklight-7.3.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-7.2.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-7.1.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-7.1.0.alpha spec/views/catalog/index.html.erb_spec.rb
blacklight-7.0.1 spec/views/catalog/index.html.erb_spec.rb
blacklight-7.0.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-7.0.0.rc2 spec/views/catalog/index.html.erb_spec.rb