Sha256: 086aa9eefb7bd7d3cd22d1eda80649314121bfe47b96ae9827a81ee8c5b1c1d7

Contents?: true

Size: 1.31 KB

Versions: 4

Compression:

Stored size: 1.31 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(name: name, person: person) }
  let(: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")
    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")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
curate-0.6.6 spec/views/curation_concern/base/_collection.html.erb_spec.rb
curate-0.6.5 spec/views/curation_concern/base/_collection.html.erb_spec.rb
curate-0.6.4 spec/views/curation_concern/base/_collection.html.erb_spec.rb
curate-0.6.3 spec/views/curation_concern/base/_collection.html.erb_spec.rb