Sha256: ed64527d234b776cf82778e79e865a6cd1b015a3d8e5fdf43b94cc746d495e3e

Contents?: true

Size: 1.52 KB

Versions: 13

Compression:

Stored size: 1.52 KB

Contents

# frozen_string_literal: true
require 'spec_helper'

describe 'catalog/_show_downloads.html.erb', type: :view do
  context 'document is downloadable' do
    let(:document) { instance_double(SolrDocument) }
    before do
      assign :document, document

      allow(document).to receive(:restricted?).and_return(false)
      allow(document).to receive(:direct_download).and_return(test: :test)
      allow(document).to receive(:hgl_download).and_return({})
      allow(document).to receive(:iiif_download).and_return({})
      allow(document).to receive(:download_types).and_return(shapefile: {})
    end
    it 'renders the button group with primary and generated partials' do
      expect(view).to receive(:document_downloadable?).and_return(true)

      stub_template 'catalog/_downloads_primary.html.erb' => 'stubbed_primary_downloads'
      stub_template 'catalog/_downloads_generated.html.erb' => 'stubbed_generated_downloads'

      render

      expect(rendered).to have_content 'stubbed_primary_downloads'
      expect(rendered).to have_content 'stubbed_generated_downloads'
    end
  end
  context 'document is not downloadable' do
    let(:document) { instance_double(SolrDocument, restricted?: true, same_institution?: true) }
    before do
      expect(view).to receive(:document_downloadable?).and_return(false)
    end

    context 'when restricted & same institution' do
      it 'renders login link' do
        assign :document, document
        render
        expect(rendered).to have_css '.card-header a'
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
geoblacklight-3.6.0 spec/views/catalog/_show_downloads.html.erb_spec.rb
geoblacklight-3.5.0 spec/views/catalog/_show_downloads.html.erb_spec.rb
geoblacklight-4.0.0.pre.alpha.3 spec/views/catalog/_show_downloads.html.erb_spec.rb
geoblacklight-4.0.0.pre.alpha.2 spec/views/catalog/_show_downloads.html.erb_spec.rb
geoblacklight-4.0.0.pre.alpha.1 spec/views/catalog/_show_downloads.html.erb_spec.rb
geoblacklight-4.0.0.pre.alpha spec/views/catalog/_show_downloads.html.erb_spec.rb
geoblacklight-3.4.0 spec/views/catalog/_show_downloads.html.erb_spec.rb
geoblacklight-3.3.1 spec/views/catalog/_show_downloads.html.erb_spec.rb
geoblacklight-3.3.0 spec/views/catalog/_show_downloads.html.erb_spec.rb
geoblacklight-3.2.0 spec/views/catalog/_show_downloads.html.erb_spec.rb
geoblacklight-3.1.0 spec/views/catalog/_show_downloads.html.erb_spec.rb
geoblacklight-3.0.1 spec/views/catalog/_show_downloads.html.erb_spec.rb
geoblacklight-3.0.0 spec/views/catalog/_show_downloads.html.erb_spec.rb