Sha256: 930324ffac3053da7fdc51823a05486823655158cd1541375bf665fd88f6272c

Contents?: true

Size: 1.42 KB

Versions: 1

Compression:

Stored size: 1.42 KB

Contents

# frozen_string_literal: true
require 'spec_helper'

describe "catalog/_paginate_compact.html.erb" do
  let(:user) { User.new.tap { |u| u.save(validate: false) } }
  
  before do
    controller.request.path_parameters[:action] = 'index'
  end

  describe "with a real solr response", :integration => true do  
    def blacklight_config
      @config ||= CatalogController.blacklight_config
    end
    
    def blacklight_config=(config)
      @config = config
    end

    def facet_limit_for *args
      0
    end

    include Blacklight::SearchHelper

    it "should render solr responses" do
      solr_response, document_list = search_results(q: '')

      render :partial => 'catalog/paginate_compact', :object => solr_response
      expect(rendered).to have_selector ".page_entries"
      expect(rendered).to have_selector "a[@rel=next]"
    end
  end

  it "should render paginatable arrays" do
    render :partial => 'catalog/paginate_compact', :object => (Kaminari.paginate_array([], total_count: 145).page(1).per(10))
    expect(rendered).to have_selector ".page_entries"
    expect(rendered).to have_selector "a[@rel=next]"
  end

  it "should render ActiveRecord collections" do
    50.times { b = Bookmark.new;  b.user = user; b.save! }
    render :partial => 'catalog/paginate_compact', :object => Bookmark.page(1).per(25)
    expect(rendered).to have_selector ".page_entries"
    expect(rendered).to have_selector "a[@rel=next]"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blacklight-6.2.0 spec/views/catalog/_paginate_compact.html.erb_spec.rb