Sha256: 8aedbd69fcbd5efd8989b3db5288bd89bec74e21060768fd11c964f2007b2c6c

Contents?: true

Size: 1.05 KB

Versions: 14

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

RSpec.describe 'catalog/facet.html.erb' do
  let(:display_facet) { double }
  let(:blacklight_config) { Blacklight::Configuration.new }
  let(:component) { instance_double(Blacklight::FacetComponent) }

  before do
    allow(Blacklight::FacetComponent).to receive(:new).and_return(component)
    allow(view).to receive(:render).and_call_original
    allow(view).to receive(:render).with(component)

    blacklight_config.add_facet_field 'xyz', label: "Facet title"
    allow(view).to receive(:blacklight_config).and_return(blacklight_config)
    stub_template 'catalog/_facet_pagination.html.erb' => 'pagination'
    assign :facet, blacklight_config.facet_fields['xyz']
    assign :display_facet, display_facet
  end

  it "has the facet title" do
    render
    expect(rendered).to have_selector 'h1', text: "Facet title"
  end

  it "renders facet pagination" do
    render
    expect(rendered).to have_content 'pagination'
  end

  it "renders the facet limit" do
    render
    expect(view).to have_received(:render).with(component)
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
blacklight-8.2.2 spec/views/catalog/facet.html.erb_spec.rb
blacklight-8.2.1 spec/views/catalog/facet.html.erb_spec.rb
blacklight-8.2.0 spec/views/catalog/facet.html.erb_spec.rb
blacklight-8.1.0 spec/views/catalog/facet.html.erb_spec.rb
blacklight-8.0.1 spec/views/catalog/facet.html.erb_spec.rb
blacklight-8.0.0 spec/views/catalog/facet.html.erb_spec.rb
blacklight-8.0.0.beta8 spec/views/catalog/facet.html.erb_spec.rb
blacklight-8.0.0.beta7 spec/views/catalog/facet.html.erb_spec.rb
blacklight-8.0.0.beta6 spec/views/catalog/facet.html.erb_spec.rb
blacklight-8.0.0.beta5 spec/views/catalog/facet.html.erb_spec.rb
blacklight-8.0.0.beta4 spec/views/catalog/facet.html.erb_spec.rb
blacklight-8.0.0.beta3 spec/views/catalog/facet.html.erb_spec.rb
blacklight-8.0.0.beta2 spec/views/catalog/facet.html.erb_spec.rb
blacklight-8.0.0.beta1 spec/views/catalog/facet.html.erb_spec.rb