Sha256: 76d4ee3f5b2d138e6c54a2292289767c8599874722682b051dcd2fc540820233

Contents?: true

Size: 1.24 KB

Versions: 17

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'

describe Geoblacklight::Relation::Descendants do
  let(:repository) { Blacklight::Solr::Repository.new(CatalogController.blacklight_config) }
  let(:descendants) { described_class.new('nyu_2451_34636', repository) }
  let(:empty_descendants) { described_class.new('harvard-g7064-s2-1834-k3', repository) }

  describe '#create_search_params' do
    it 'assembles the correct search params for finding descendant documents' do
      expect(descendants.create_search_params).to eq(fq: "#{Settings.FIELDS.SOURCE}:nyu_2451_34636", fl: [Settings.FIELDS.TITLE.to_s, 'layer_slug_s'])
    end
  end

  describe '#execute_query' do
    it 'executes the query for finding descendants, return response' do
      expect(descendants.execute_query).to include('responseHeader')
    end
  end

  describe '#results' do
    it 'produces a hash of results from the query' do
      expect(descendants.results).to include('numFound')
      expect(descendants.results).to include('docs')
    end
    it 'has non-zero numfound for a document with descendants' do
      expect(descendants.results['numFound']).to be > 0
    end
    it 'has zero numfound for a document without descendants' do
      expect(empty_descendants.results['numFound']).to eq(0)
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
geoblacklight-2.3.0 spec/lib/geoblacklight/relation/descendants_spec.rb
geoblacklight-2.2.1 spec/lib/geoblacklight/relation/descendants_spec.rb
geoblacklight-2.2.0 spec/lib/geoblacklight/relation/descendants_spec.rb
geoblacklight-2.1.2 spec/lib/geoblacklight/relation/descendants_spec.rb
geoblacklight-2.1.1 spec/lib/geoblacklight/relation/descendants_spec.rb
geoblacklight-2.1.0 spec/lib/geoblacklight/relation/descendants_spec.rb
geoblacklight-2.0.0 spec/lib/geoblacklight/relation/descendants_spec.rb
geoblacklight-1.9.1 spec/lib/geoblacklight/relation/descendants_spec.rb
geoblacklight-1.9.0 spec/lib/geoblacklight/relation/descendants_spec.rb
geoblacklight-1.8.0 spec/lib/geoblacklight/relation/descendants_spec.rb
geoblacklight-1.7.1 spec/lib/geoblacklight/relation/descendants_spec.rb
geoblacklight-1.7.0 spec/lib/geoblacklight/relation/descendants_spec.rb
geoblacklight-1.6.0 spec/lib/geoblacklight/relation/descendants_spec.rb
geoblacklight-1.5.1 spec/lib/geoblacklight/relation/descendants_spec.rb
geoblacklight-1.5.0 spec/lib/geoblacklight/relation/descendants_spec.rb
geoblacklight-1.4.0 spec/lib/geoblacklight/relation/descendants_spec.rb
geoblacklight-1.3.0 spec/lib/geoblacklight/relation/descendants_spec.rb