Sha256: 0e468ad5f884a0672736b8508373f59d212ceaea647c2557e481388a55f64861

Contents?: true

Size: 1.53 KB

Versions: 3

Compression:

Stored size: 1.53 KB

Contents

require 'spec_helper'

describe 'curate/people/show.html.erb' do
  let(:person) { FactoryGirl.create(:person_with_user) }
  let(:user) { person.user }

  context 'A person who has a collection in their profile' do
    let(:outer_collection) { FactoryGirl.create(:collection, user: user, title: 'Outer Collection') }
    let(:inner_collection) { FactoryGirl.create(:collection, user: user, title: 'Inner Collection') }
    let(:outer_work) { FactoryGirl.create(:generic_work, user: user, title: 'Outer Work') }
    let(:inner_work) { FactoryGirl.create(:generic_work, user: user, title: 'Inner Work') }

    before do
      inner_collection.members << inner_work
      inner_collection.save!
      outer_collection.members << inner_collection
      outer_collection.save!

      person.profile.members << [outer_collection, outer_work]
      person.profile.save!
      assign :person, person
      controller.stub(:current_user).and_return(user)

      render
    end

    it 'lists the items within the outer collection, but not the inner collection' do
      assert_select '#person_profile #documents' do
        assert_select 'ul' do
          assert_select 'a[href=?]', collection_path(outer_collection), text: 'Outer Collection'
          assert_select 'a[href=?]', collection_path(inner_collection), text: 'Inner Collection'
          assert_select 'a[href=?]', curation_concern_generic_work_path(outer_work), text: 'Outer Work'
          assert_select 'a[href=?]', curation_concern_generic_work_path(inner_work), count: 0
        end
      end
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
curate-0.5.1 spec/views/curate/people/show.html.erb_spec.rb
curate-0.5.0 spec/views/curate/people/show.html.erb_spec.rb
curate-0.4.2 spec/views/curate/people/show.html.erb_spec.rb