Sha256: 0e74d17dde2968bed65f2267075b900aeea2e239f4964ea083ea8c5e0b5d2227

Contents?: true

Size: 1.45 KB

Versions: 4

Compression:

Stored size: 1.45 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
      Deprecation.silence(Blacklight) { 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

4 entries across 4 versions & 1 rubygems

Version Path
blacklight-4.9.0 spec/views/catalog/_paginate_compact.html.erb_spec.rb
blacklight-4.8.0 spec/views/catalog/_paginate_compact.html.erb_spec.rb
blacklight-4.7.0 spec/views/catalog/_paginate_compact.html.erb_spec.rb
blacklight-4.7.0.pre1 spec/views/catalog/_paginate_compact.html.erb_spec.rb