Sha256: 6812b976ebc6a3c3265feec5b8a90651058ee69b94a57d16fdd945774e0fe5c7

Contents?: true

Size: 963 Bytes

Versions: 7

Compression:

Stored size: 963 Bytes

Contents

require 'spec_helper'

describe 'hyrax/file_sets/mdeia_display/_default.html.erb', type: :view do
  let(:file_set) { stub_model(FileSet) }
  let(:config) { double }
  let(:link) { true }

  before do
    allow(Hyrax.config).to receive(:display_media_download_link?).and_return(link)
    render 'hyrax/file_sets/media_display/default', file_set: file_set
  end

  it "draws the view with the link" do
    expect(rendered).to have_css('div.no-preview')
    expect(rendered).to have_css('a', text: 'Download the file')
  end

  it "includes google analytics data in the download link" do
    expect(rendered).to have_css('a#file_download')
    expect(rendered).to have_selector("a[data-label=\"#{file_set.id}\"]")
  end

  context "no download links" do
    let(:link) { false }

    it "draws the view without the link" do
      expect(rendered).to have_css('div.no-preview')
      expect(rendered).not_to have_css('a', text: 'Download the file')
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hyrax-1.1.1 spec/views/hyrax/file_sets/media_display/_default.html.erb_spec.rb
hyrax-1.1.0 spec/views/hyrax/file_sets/media_display/_default.html.erb_spec.rb
hyrax-1.0.5 spec/views/hyrax/file_sets/media_display/_default.html.erb_spec.rb
hyrax-1.0.4 spec/views/hyrax/file_sets/media_display/_default.html.erb_spec.rb
hyrax-1.0.3 spec/views/hyrax/file_sets/media_display/_default.html.erb_spec.rb
hyrax-1.0.2 spec/views/hyrax/file_sets/media_display/_default.html.erb_spec.rb
hyrax-1.0.1 spec/views/hyrax/file_sets/media_display/_default.html.erb_spec.rb