Sha256: 03016c990ff09a8f8dceac5c6d3b9eef6bb23bbbb09b581799f5953a88b21f8a
Contents?: true
Size: 1.45 KB
Versions: 84
Compression:
Stored size: 1.45 KB
Contents
# frozen_string_literal: true RSpec.describe Blacklight::Suggest::Response, api: true do let(:empty_response) { described_class.new({}, { q: 'hello' }, 'suggest', 'mySuggester') } 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', 'mySuggester' ) end describe '#initialize' do it 'creates a Blacklight::Suggest::Response' do expect(empty_response).to be_an described_class 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
84 entries across 84 versions & 2 rubygems