Sha256: 40a3ac24bb4127dec68f87b2dcdd6a780a969d2f2ecad5fb040d9b2f2f686251

Contents?: true

Size: 1.12 KB

Versions: 11

Compression:

Stored size: 1.12 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_messages(has_search_parameters?: false, blacklight_config: CatalogController.blacklight_config)
      @response = instance_double(Blacklight::Solr::Response, empty?: true, total: 11, start: 1, limit_value: 10, aggregations: {})
    end

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

    it "renders the Search::SidebarComponent component" do
      render

      expect(sidebar).to match /Limit your search/
    end
  end

  describe "with search parameters" do
    before do
      stub_template "catalog/_results_pagination.html.erb" => ""
      stub_template "catalog/_search_header.html.erb" => "header_content"
      allow(view).to receive_messages(has_search_parameters?: true, blacklight_config: Blacklight::Configuration.new)
      @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

11 entries across 11 versions & 2 rubygems

Version Path
blacklight-8.8.2 spec/views/catalog/index.html.erb_spec.rb
blacklight-8.8.1 spec/views/catalog/index.html.erb_spec.rb
blacklight-8.8.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-8.7.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-8.6.1 spec/views/catalog/index.html.erb_spec.rb
blacklight-8.6.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-8.5.1 spec/views/catalog/index.html.erb_spec.rb
blacklight-8.5.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-8.4.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-8.3.0/spec/views/catalog/index.html.erb_spec.rb
blacklight-8.3.0 spec/views/catalog/index.html.erb_spec.rb