Sha256: c0695658de286d52567a9cfaddb6960f24467990605da1db30fc03f75f5b6654

Contents?: true

Size: 1.57 KB

Versions: 95

Compression:

Stored size: 1.57 KB

Contents

# frozen_string_literal: true

RSpec.describe "catalog/_sort_and_per_page" do
  let(:blacklight_config) { Blacklight::Configuration.new }

  before do
    blacklight_config.add_results_collection_tool(:sort_widget)
    blacklight_config.add_results_collection_tool(:per_page_widget)
    blacklight_config.add_results_collection_tool(:view_type_group)
    allow(view).to receive_messages(blacklight_config: blacklight_config)
  end

  it "renders the pagination, sort, per page and view type controls" do
    assign(:response, instance_double(Blacklight::Solr::Response, limit_value: 1))
    stub_template "catalog/_paginate_compact.html.erb" => "paginate_compact"
    stub_template "catalog/_sort_widget.html.erb" => "sort_widget"
    stub_template "catalog/_per_page_widget.html.erb" => "per_page_widget"
    stub_template "catalog/_view_type_group.html.erb" => "view_type_group"
    render
    expect(rendered).to match /paginate_compact/
    expect(rendered).to match /sort_widget/
    expect(rendered).to match /per_page_widget/
    expect(rendered).to match /view_type_group/
  end

  it "does not render the pagination controls with bad limit values" do
    assign(:response, instance_double(Blacklight::Solr::Response, limit_value: 0))
    stub_template "catalog/_paginate_compact.html.erb" => "paginate_compact"
    stub_template "catalog/_sort_widget.html.erb" => "sort_widget"
    stub_template "catalog/_per_page_widget.html.erb" => "per_page_widget"
    stub_template "catalog/_view_type_group.html.erb" => "view_type_group"
    render
    expect(rendered).not_to match /paginate_compact/
  end
end

Version data entries

95 entries across 94 versions & 2 rubygems

Version Path
blacklight-8.6.1 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-7.40.0 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-8.6.0 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-8.5.1 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-8.5.0 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-7.39.0 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-8.4.0 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-7.38.0 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-8.3.0/spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-7.37.0/spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-8.3.0 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-8.2.2 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-8.2.1 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-8.2.0 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-7.37.0 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-7.36.2 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-7.36.1 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-7.36.0 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-7.35.0 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-8.1.0 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb