Sha256: bf03fb95ba38918c8ee91b1765e50179d16d3c75ecc4e5e5e8373702963af9aa

Contents?: true

Size: 1.16 KB

Versions: 8

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

describe Geoblacklight::Relation::RelationResponse do
  let(:repository) { Blacklight::Solr::Repository.new(CatalogController.blacklight_config) }
  let(:relation_resp) { described_class.new('nyu_2451_34502', repository) }
  let(:empty_relation_resp) { described_class.new('harvard-g7064-s2-1834-k3', repository) }
  describe '#initialize' do
    it 'creates a RelationResponse' do
      expect(relation_resp).to be_an described_class
    end
  end

  describe '#ancestors' do
    it 'returns a hash of ancestor documents' do
      expect(relation_resp.ancestors).to include('numFound')
      expect(relation_resp.ancestors).to include('docs')
    end
  end

  describe '#descendants' do
    it 'returns a hash of descendant documents' do
      expect(relation_resp.ancestors).to include('numFound')
      expect(relation_resp.ancestors).to include('docs')
    end
  end

  describe '#empty?' do
    it 'returns false if document has ancestors or descendants' do
      expect(relation_resp.empty?).to be false
    end
    it 'returns true if document has neither ancestors nor descendants' do
      expect(empty_relation_resp.empty?).to be true
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
geoblacklight-1.8.0 spec/lib/geoblacklight/relation/relation_response_spec.rb
geoblacklight-1.7.1 spec/lib/geoblacklight/relation/relation_response_spec.rb
geoblacklight-1.7.0 spec/lib/geoblacklight/relation/relation_response_spec.rb
geoblacklight-1.6.0 spec/lib/geoblacklight/relation/relation_response_spec.rb
geoblacklight-1.5.1 spec/lib/geoblacklight/relation/relation_response_spec.rb
geoblacklight-1.5.0 spec/lib/geoblacklight/relation/relation_response_spec.rb
geoblacklight-1.4.0 spec/lib/geoblacklight/relation/relation_response_spec.rb
geoblacklight-1.3.0 spec/lib/geoblacklight/relation/relation_response_spec.rb