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.4.0 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-3.3.0 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-3.2.0 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-3.1.0 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-3.0.3 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-3.0.2 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-3.0.1 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-3.0.0 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-3.0.0.rc6 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-3.0.0.rc5 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-3.0.0.rc4 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-3.0.0.rc3 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-3.0.0.rc2 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-3.0.0.rc1 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-3.0.0.alpha.10 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-3.0.0.alpha.9 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-3.0.0.alpha.8 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-3.0.0.alpha.7 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-3.0.0.alpha.6 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-3.0.0.alpha.5 spec/helpers/spotlight/search_configurations_helper_spec.rb