Sha256: 5ccfbd57ee522e13749d85510e1bc7d07c914c2634f02fd979ac2ef6bf0db7dd

Contents?: true

Size: 1.2 KB

Versions: 14

Compression:

Stored size: 1.2 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(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
      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)
      @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

14 entries across 14 versions & 1 rubygems

Version Path
blacklight-8.2.2 spec/views/catalog/index.html.erb_spec.rb
blacklight-8.2.1 spec/views/catalog/index.html.erb_spec.rb
blacklight-8.2.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-8.1.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-8.0.1 spec/views/catalog/index.html.erb_spec.rb
blacklight-8.0.0 spec/views/catalog/index.html.erb_spec.rb
blacklight-8.0.0.beta8 spec/views/catalog/index.html.erb_spec.rb
blacklight-8.0.0.beta7 spec/views/catalog/index.html.erb_spec.rb
blacklight-8.0.0.beta6 spec/views/catalog/index.html.erb_spec.rb
blacklight-8.0.0.beta5 spec/views/catalog/index.html.erb_spec.rb
blacklight-8.0.0.beta4 spec/views/catalog/index.html.erb_spec.rb
blacklight-8.0.0.beta3 spec/views/catalog/index.html.erb_spec.rb
blacklight-8.0.0.beta2 spec/views/catalog/index.html.erb_spec.rb
blacklight-8.0.0.beta1 spec/views/catalog/index.html.erb_spec.rb