Sha256: 66df4d9eba74eea03e09d64acdb8d4e6d6fbf0dbe5f41a434bc65d6c57504ca5

Contents?: true

Size: 1.41 KB

Versions: 3

Compression:

Stored size: 1.41 KB

Contents

require 'spec_helper'

describe "catalog/_paginate_compact.html.erb" do

  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 blacklight_solr
      Blacklight.solr
    end

    def facet_limit_for *args
      0
    end

    include Blacklight::SolrHelper

    it "should render solr responses" do
      solr_response, document_list = get_search_results(:q => '')
      assign :response, solr_response
      render :partial => 'catalog/paginate_compact'
      expect(rendered).to have_selector "a[@rel=next]"
    end
  end

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

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
blacklight-4.6.3 spec/views/catalog/_paginate_compact.html.erb_spec.rb
blacklight-4.6.2 spec/views/catalog/_paginate_compact.html.erb_spec.rb
blacklight-4.6.1 spec/views/catalog/_paginate_compact.html.erb_spec.rb