Sha256: 59f68c060402999bb1a1a6924ffedac8ec498922f06cfe6cb26c38b54ff68813

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe 'curation_concern/base/_add_to_collection_gui' do
  let(:curation_concern) { FactoryGirl.create(:generic_work) }
  let(:current_user) { double(display_name: display_name, person: person) }
  let(:display_name) { 'My Display Name'}
  let(:person) { FactoryGirl.create(:person_with_user) }
  let(:user) { person.user }

  context 'with collections' do
    before do
      assign :person, person
      controller.stub(:current_user).and_return(user)
      render partial: 'add_to_collection_gui', locals: { collectible: curation_concern }
    end

    it 'displays the link to add work to a collection' do
      rendered.should have_link('Add to Collection', add_member_form_collections_path(collectible_id: curation_concern.pid))
    end
  end

  context 'with no collections' do
    before do
      assign :person, person
      controller.stub(:current_user).and_return(nil)
      render partial: 'add_to_collection_gui', locals: { collectible: curation_concern }
    end

    it 'displays no link' do
      rendered.should_not have_link('Add to Collection')
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
curate-0.5.4 spec/views/curation_concern/base/_add_to_collection_gui.html.erb_spec.rb
curate-0.5.2 spec/views/curation_concern/base/_add_to_collection_gui.html.erb_spec.rb