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.26.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.25.3 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.25.2 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.25.1 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.25.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.24.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.23.0.1 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.23.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.22.2 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.22.1 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.22.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.21.2 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.21.1 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.21.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.20.1 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.20.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.19.2 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.19.1 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.19.0 spec/presenters/blacklight/clause_presenter_spec.rb
blacklight-7.18.1 spec/presenters/blacklight/clause_presenter_spec.rb