Sha256: 2453b6d0652f6aedcbb0c8e58b8f1cd5529fe0d6b62a94fecf151e4351f0763a

Contents?: true

Size: 1.09 KB

Versions: 22

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Blacklight::ClausePresenter, type: :presenter do
  subject(:presenter) do
    described_class.new('0', params.with_indifferent_access.dig(:clause, '0'), field_config, controller.view_context, search_state)
  end

  let(:field_config) { Blacklight::Configuration::NullField.new key: 'some_field' }
  let(:search_state) { Blacklight::SearchState.new(params.with_indifferent_access, Blacklight::Configuration.new) }
  let(:params) { {} }

  describe '#field_label' do
    it 'returns a label for the field' do
      expect(subject.field_label).to eq 'Some Field'
    end
  end

  describe '#label' do
    let(:params) { { clause: { '0' => { query: 'some search string' } } } }

    it 'returns the query value for the clause' do
      expect(subject.label).to eq 'some search string'
    end
  end

  describe '#remove_href' do
    let(:params) { { clause: { '0' => { query: 'some_search_string' } } } }

    it 'returns the href to remove the search clause' do
      expect(subject.remove_href).not_to include 'some_search_string'
    end
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
blacklight-8.7.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-8.6.1 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-8.6.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-8.5.1 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-8.5.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-8.4.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-8.3.0/spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-8.3.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-8.2.2 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-8.2.1 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-8.2.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-8.1.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-8.0.1 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-8.0.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-8.0.0.beta8 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-8.0.0.beta7 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-8.0.0.beta6 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-8.0.0.beta5 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-8.0.0.beta4 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-8.0.0.beta3 spec/presenters/blacklight/clause_presenter_spec.rb