Sha256: 979e9458421acff16f289c0f066fb2f8515c36fd1c6f264b4053765ae84c29e3

Contents?: true

Size: 996 Bytes

Versions: 1

Compression:

Stored size: 996 Bytes

Contents

require 'spec_helper'

describe 'curation_concerns/base/relationships' do
  let(:ability) { double }
  let(:solr_doc) { double(id: '123', human_readable_type: 'Work') }
  let(:presenter) { Sufia::WorkShowPresenter.new(solr_doc, ability) }

  context "when collections are not present" do
    before do
      render 'curation_concerns/base/relationships', presenter: presenter
    end
    it "shows the message" do
      expect(rendered).to match %r{This Work is not currently in any collections\.}
    end
  end

  context "when collections are present" do
    let(:collection_presenters) { [double(id: '456', title: 'Containing collection')] }
    let(:page) { Capybara::Node::Simple.new(rendered) }
    before do
      allow(presenter).to receive(:collection_presenters).and_return(collection_presenters)
      render 'curation_concerns/base/relationships', presenter: presenter
    end
    it "links to collections" do
      expect(page).to have_link 'Containing collection'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sufia-7.0.0.beta1 spec/views/curation_concerns/base/_relationships.html.erb_spec.rb