Sha256: f2c9f67b348cce8919834d0fd0beb225ae566b267538369d54622b7b32b8db05

Contents?: true

Size: 1.09 KB

Versions: 48

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

48 entries across 48 versions & 2 rubygems

Version Path
blacklight-7.40.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.39.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.38.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-7.37.0/spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.37.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.36.2 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.36.1 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.36.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.35.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.34.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.33.1 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.33.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.32.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.31.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.30.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.29.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.28.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.27.1 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.27.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.26.1 spec/presenters/blacklight/clause_presenter_spec.rb