Sha256: 1756baeaff65f4c8b7cd9120e5c074eb26f39e782d44bc8579afa0fcc36e17a0

Contents?: true

Size: 1.25 KB

Versions: 5

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

describe Geoblacklight::SolrDocument::CartoDb do
  let(:subject) { SolrDocument.new }
  describe '#cartodb_reference' do
    it 'returns nil for restricted documents' do
      expect(subject).to receive(:public?).and_return(false)
      expect(subject.cartodb_reference).to be_nil
    end
    it 'returns nil for no download_types' do
      expect(subject).to receive(:public?).and_return(true)
      expect(subject).to receive(:download_types).and_return(nil)
      expect(subject.cartodb_reference).to be_nil
    end
    it 'returns nil with no :geojson download type' do
      expect(subject).to receive(:public?).and_return(true)
      expect(subject).to receive(:download_types).and_return(geotiff: 'geotiff')
      expect(subject.cartodb_reference).to be_nil
    end
    it 'Creates and returns a GeojsonDownload url' do
      expect(subject).to receive(:public?).and_return(true)
      expect(subject).to receive(:download_types)
        .and_return(geojson: { 'stuff' => 'stuff' })
      expect_any_instance_of(Geoblacklight::GeojsonDownload)
        .to receive(:url_with_params)
        .and_return('http://www.example.com/geojsonDownload')
      expect(subject.cartodb_reference).to eq 'http://www.example.com/geojsonDownload'
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
geoblacklight-0.12.1 spec/models/concerns/geoblacklight/solr_document/carto_db_spec.rb
geoblacklight-0.12.0 spec/models/concerns/geoblacklight/solr_document/carto_db_spec.rb
geoblacklight-0.11.1 spec/lib/geoblacklight/solr_document/carto_db_spec.rb
geoblacklight-0.11.0 spec/lib/geoblacklight/solr_document/carto_db_spec.rb
geoblacklight-0.10.2 spec/lib/geoblacklight/solr_document/carto_db_spec.rb