Sha256: 0eb814a763d611fa3d4dd71e1bea203fea260077f210712c1944c177d4958023

Contents?: true

Size: 766 Bytes

Versions: 40

Compression:

Stored size: 766 Bytes

Contents

# frozen_string_literal: true

describe Spotlight::SearchConfigurationsHelper, type: :helper do
  describe '#translate_sort_fields' do
    let(:sort_config) do
      Blacklight::OpenStructWithHashAccess.new(sort: 'score asc, sort_title_ssi desc')
    end

    it 'translates sort fields' do
      expect(translate_sort_fields(sort_config)).to eq 'relevancy score ascending and title descending'
    end

    it 'humanizes untranslatable sort fields' do
      sort_config.sort = 'some_other_field desc'
      expect(translate_sort_fields(sort_config)).to eq 'some other field descending'
    end

    it 'supports explicit sort descriptions' do
      sort_config.sort_description = 'xyz'
      expect(translate_sort_fields(sort_config)).to eq 'xyz'
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
blacklight-spotlight-3.0.0.alpha.4 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-3.0.0.alpha.3 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-3.0.0.alpha.2 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-3.0.0.alpha.1 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-2.13.0 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-2.12.1 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-2.12.0 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-2.11.0 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-2.10.0 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-2.9.0 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-2.8.0 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-2.7.2 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-2.7.1 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-2.7.0 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-2.6.1.1 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-2.6.1 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-2.6.0 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-2.5.2 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-2.5.1 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-2.5.0 spec/helpers/spotlight/search_configurations_helper_spec.rb