Sha256: 0c70f94f866e3722d86f13473740cb9439af13f64f2c47b35be4d36a08509a11

Contents?: true

Size: 1.3 KB

Versions: 28

Compression:

Stored size: 1.3 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(controller).to receive(:search_state_class).and_return(Blacklight::SearchState)
      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("")
      @response = instance_double(Blacklight::Solr::Response, empty?: true, total: 11, start: 1, limit_value: 10)
    end

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

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
blacklight-7.40.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-7.39.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-7.38.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-7.37.0/spec/views/catalog/index.html.erb_spec.rb
blacklight-7.37.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-7.36.2 spec/views/catalog/index.html.erb_spec.rb
blacklight-7.36.1 spec/views/catalog/index.html.erb_spec.rb
blacklight-7.36.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-7.35.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-7.34.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-7.33.1 spec/views/catalog/index.html.erb_spec.rb
blacklight-7.33.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-7.32.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-7.31.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-7.30.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-7.29.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-7.28.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-7.27.1 spec/views/catalog/index.html.erb_spec.rb
blacklight-7.27.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-7.26.1 spec/views/catalog/index.html.erb_spec.rb