Sha256: 06a1f26002cc540ad0f3746483f4100eebc8b91de0d216d05beb2843c753c1c8

Contents?: true

Size: 1.44 KB

Versions: 2

Compression:

Stored size: 1.44 KB

Contents

require 'spec_helper'

describe 'curation_concern/base/_collection.html.erb' do
  let(:curation_concern) { FactoryGirl.create(:generic_work, user: user) }
  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 }
  let(:collection) { FactoryGirl.create(:collection, user: user, title: 'Collection 1') }

  context 'logged in' do
    before do
      curation_concern.collections << collection
      curation_concern.save!
      assign :person, person
      controller.stub(:current_user).and_return(user)
      render partial: 'collections', curation_concern: curation_concern, locals: { curation_concern: curation_concern }
    end

    it 'lists all the collections the work is added to' do
      expect(rendered).to include("Collection 1")
      expect(rendered).to include("Add to Collection")
    end
  end

  context 'public view:' do
    before do
      curation_concern.collections << collection
      curation_concern.save!
      assign :person, person
      controller.stub(:current_user).and_return(nil)
      render partial: 'collections', curation_concern: curation_concern, locals: { curation_concern: curation_concern }
    end

    it 'lists all the collections the work is added to' do
      expect(rendered).to include("Collection 1")
      expect(rendered).not_to include("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/_collection.html.erb_spec.rb
curate-0.5.2 spec/views/curation_concern/base/_collection.html.erb_spec.rb