Sha256: c2dfc792dfba279b491e99ab12413a2fce99f73b8172c75e03ec425f973e6c95

Contents?: true

Size: 1.38 KB

Versions: 8

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'

describe 'curation_concerns/file_sets/_show_actions.html.erb', type: :view do
  let(:user) { create(:user) }
  let(:object_profile) { ["{\"id\":\"999\"}"] }
  let(:contributor) { ['Frodo'] }
  let(:creator)     { ['Bilbo'] }
  let(:solr_document) {
    SolrDocument.new(
      id: '999',
      object_profile_ssm: object_profile,
      has_model_ssim: ['FileSet'],
      human_readable_type_tesim: ['File'],
      contributor_tesim: contributor,
      creator_tesim: creator,
      rights_tesim: ['http://creativecommons.org/licenses/by/3.0/us/']
    )
  }
  let(:ability) { Ability.new(user) }
  let(:presenter) do
    Sufia::WorkShowPresenter.new(solr_document, ability)
  end
  describe 'citations' do
    let(:page) { Capybara::Node::Simple.new(rendered) }
    before do
      Sufia.config.citations = citations
      allow(controller).to receive(:can?).with(:edit, presenter).and_return(false)
      assign(:presenter, presenter)
      view.lookup_context.view_paths.push 'app/views/curation_concerns/base'
      render
    end

    context 'when enabled' do
      let(:citations) { true }

      it 'appears on page' do
        expect(page).to have_selector('a#citations', count: 1)
      end
    end

    context 'when disabled' do
      let(:citations) { false }

      it 'does not appear on page' do
        expect(page).to have_no_selector('a#citations')
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sufia-7.1.0 spec/views/curation_concerns/file_sets/_show_actions.html.erb_spec.rb
sufia-7.0.0 spec/views/curation_concerns/file_sets/_show_actions.html.erb_spec.rb
sufia-7.0.0.rc2 spec/views/curation_concerns/file_sets/_show_actions.html.erb_spec.rb
sufia-7.0.0.rc1 spec/views/curation_concerns/file_sets/_show_actions.html.erb_spec.rb
sufia-7.0.0.beta4 spec/views/curation_concerns/file_sets/_show_actions.html.erb_spec.rb
sufia-7.0.0.beta3 spec/views/curation_concerns/file_sets/_show_actions.html.erb_spec.rb
sufia-7.0.0.beta2 spec/views/curation_concerns/file_sets/_show_actions.html.erb_spec.rb
sufia-7.0.0.beta1 spec/views/curation_concerns/file_sets/_show_actions.html.erb_spec.rb