Sha256: 6668f77d7d5eca6328a91908225b7227adb0dae0879222530f658008276c9aae
Contents?: true
Size: 1.42 KB
Versions: 1
Compression:
Stored size: 1.42 KB
Contents
# frozen_string_literal: true RSpec.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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
blacklight-7.0.0.rc1 | spec/models/blacklight/suggest/response_spec.rb |