Sha256: d6a271d1d765914fca373798a52d85641ec7d9f5f3ea50fbfa2b565b813d9eb7

Contents?: true

Size: 1.54 KB

Versions: 29

Compression:

Stored size: 1.54 KB

Contents

require 'spec_helper'

describe "catalog/_sort_and_per_page" do

  let :blacklight_config do
    Blacklight::Configuration.new
  end

  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 "should render the pagination, sort, per page and view type controls" do
    assign(:response, double("SolrResponse", 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 "should not render the pagination controls with bad limit values" do
    assign(:response, double("SolrResponse", 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

29 entries across 29 versions & 1 rubygems

Version Path
blacklight-6.0.0.pre3 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-5.16.3 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-5.16.2 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-5.16.1 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-6.0.0.pre2 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-6.0.0.pre1 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-5.16.0 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-5.15.0 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-5.14.0 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-5.13.1 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-5.13.0 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-5.11.3 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-5.12.1 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-5.12.0 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-5.10.3 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-5.9.4 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-5.11.2 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-5.11.1 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-5.11.0 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb
blacklight-5.10.2 spec/views/catalog/_sort_and_per_page.html.erb_spec.rb