Sha256: cb48bc1974b9a5886980ead8bb4a9dd603a7def40eef8392bbbe17105a7ed7e0

Contents?: true

Size: 759 Bytes

Versions: 27

Compression:

Stored size: 759 Bytes

Contents

require 'spec_helper'

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

27 entries across 27 versions & 1 rubygems

Version Path
blacklight-spotlight-0.18.0 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-0.17.1 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-0.17.0 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-0.16.0 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-0.15.0 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-0.14.2 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-0.14.1 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-0.14.0 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-0.13.0 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-0.12.1 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-0.12.0 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-0.11.0 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-0.10.3 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-0.10.2 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-0.10.1 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-0.10.0 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-0.9.2 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-0.9.1 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-0.9.0 spec/helpers/spotlight/search_configurations_helper_spec.rb
blacklight-spotlight-0.8.2 spec/helpers/spotlight/search_configurations_helper_spec.rb