Sha256: f634541341f1f2b62000c3650aaa5f2c5274f019b6bb19c9beeacefdbf29510d

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

RSpec.describe NewspaperWorks::NewspapersSearchBuilder do
  let(:context) { double }
  let(:search_builder) { described_class.new(context) }

  describe "#default_processor_chain" do
    subject { search_builder.default_processor_chain }
    it { is_expected.to include :facets_for_newspapers_search_form }
    it { is_expected.to include :newspaper_pages_only }
  end

  describe '#facets_for_newspapers_search_form' do
    subject { {} }
    before do
      allow(search_builder).to receive(:blacklight_config).and_return(CatalogController.blacklight_config)
      search_builder.facets_for_newspapers_search_form(subject)
    end

    it 'adds the blacklight advanced search config' do
      expect(subject["facet.field"]).to include 'genre_sim'
      expect(subject['rows']).to eq '0'
    end
  end

  describe '#newspaper_pages_only' do
    subject { {} }
    before { search_builder.newspaper_pages_only(subject) }
    it 'adds the page limit' do
      expect(subject[:fq]).to eq ["human_readable_type_sim:\"Newspaper Page\""]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
newspaper_works-1.0.1 spec/search_builders/newspaper_works/newspapers_search_builder_spec.rb
newspaper_works-1.0.0 spec/search_builders/newspaper_works/newspapers_search_builder_spec.rb
newspaper_works-0.1.0 spec/search_builders/newspaper_works/newspapers_search_builder_spec.rb