Sha256: a92f3144759dba3f39e6bebcecb10b33c23c0e083232b6cb9824d79aff980ef9

Contents?: true

Size: 970 Bytes

Versions: 22

Compression:

Stored size: 970 Bytes

Contents

# frozen_string_literal: true

describe Blacklight::SuggestSearch do
  let(:params) { {q: 'test'} }
  let(:suggest_path) { 'suggest' }
  let(:connection) { instance_double(RSolr::Client, send_and_receive: 'sent')}
  let(:repository) { instance_double(Blacklight::Solr::Repository, connection: connection) }
  let(:suggest_search) { described_class.new(params, repository)}
  describe '#suggestions' do
    it 'returns a Blacklight::Suggest::Response' do
      expect(suggest_search).to receive(:suggest_results).and_return([])
      expect(suggest_search).to receive(:suggest_handler_path).and_return(suggest_path)
      expect(suggest_search.suggestions).to be_an Blacklight::Suggest::Response
    end
  end
  describe '#suggest_results' do
    it 'calls send_and_recieve from a repository connection' do
      expect(suggest_search).to receive(:suggest_handler_path).and_return(suggest_path)
      expect(suggest_search.suggest_results).to eq 'sent'
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
blacklight-6.18.0 spec/models/blacklight/suggest_search_spec.rb
blacklight-6.17.0 spec/models/blacklight/suggest_search_spec.rb
blacklight-6.16.0 spec/models/blacklight/suggest_search_spec.rb
blacklight-6.15.0 spec/models/blacklight/suggest_search_spec.rb
blacklight-6.14.1 spec/models/blacklight/suggest_search_spec.rb
blacklight-6.14.0 spec/models/blacklight/suggest_search_spec.rb
blacklight-6.13.0 spec/models/blacklight/suggest_search_spec.rb
blacklight-6.12.0 spec/models/blacklight/suggest_search_spec.rb
blacklight-6.11.2 spec/models/blacklight/suggest_search_spec.rb
blacklight-6.11.1 spec/models/blacklight/suggest_search_spec.rb
blacklight-6.11.0 spec/models/blacklight/suggest_search_spec.rb
blacklight-6.10.1 spec/models/blacklight/suggest_search_spec.rb
blacklight-6.10.0 spec/models/blacklight/suggest_search_spec.rb
blacklight-6.9.0 spec/models/blacklight/suggest_search_spec.rb
blacklight-6.8.0 spec/models/blacklight/suggest_search_spec.rb
blacklight-6.7.3 spec/models/blacklight/suggest_search_spec.rb
blacklight-6.7.2 spec/models/blacklight/suggest_search_spec.rb
blacklight-6.7.1 spec/models/blacklight/suggest_search_spec.rb
blacklight-6.7.0 spec/models/blacklight/suggest_search_spec.rb
blacklight-6.6.2 spec/models/blacklight/suggest_search_spec.rb