Sha256: 705ad1b0abcdb76eb9f3a8e35fddac1f1f7c61131638596463372c61d4d1dbf2
Contents?: true
Size: 1.41 KB
Versions: 27
Compression:
Stored size: 1.41 KB
Contents
# frozen_string_literal: true describe Blacklight::Suggest::Response do let(:empty_response) { described_class.new({}, { q: 'hello' }, 'suggest') } let(:full_response) do described_class.new( { 'responseHeader' => { 'status' => 200 }, 'suggest' => { 'mySuggester' => { 'new' => { 'numFound' => 3, 'suggestions' => [ { 'term' => 'new jersey', 'weight' => 3, 'payload' => '' }, { 'term' => 'new jersey bridgeton biography', 'weight' => 3, 'payload' => '' }, { 'term' => 'new jersey bridgeton history', 'weight' => 3, 'payload' => '' } ] } } } }, { q: 'new' }, 'suggest' ) end describe '#initialize' do it 'creates a Blacklight::Suggest::Response' do expect(empty_response).to be_an Blacklight::Suggest::Response end end describe '#suggestions' do it 'returns an array of suggestions' do expect(full_response.suggestions).to be_an Array expect(full_response.suggestions.count).to eq 3 expect(full_response.suggestions.first['term']).to eq 'new jersey' end end end
Version data entries
27 entries across 27 versions & 1 rubygems