Sha256: c327717d6c16dadf7d813aa65994028a3eca1faeb2125194fdcc1e786e8ddee5

Contents?: true

Size: 1.02 KB

Versions: 16

Compression:

Stored size: 1.02 KB

Contents

describe Sufia::CollectionMemberService do
  let(:work_attrs) { { id: '123', title_tesim: ['A generic work'] } }

  let(:coll1_attrs) { { id: 'col1', title_tesim: ['A Collection 1'], child_object_ids_ssim: [work.id] } }
  let(:coll2_attrs) { { id: 'col2', title_tesim: ['A Collection 2'], child_object_ids_ssim: [work.id, 'abc123'] } }
  let(:coll3_attrs) { { id: 'col3', title_tesim: ['A Collection 3'], child_object_ids_ssim: ['abc123'] } }

  let(:work) { SolrDocument.new(work_attrs) }

  before do
    ActiveFedora::SolrService.add(coll1_attrs)
    ActiveFedora::SolrService.add(coll2_attrs)
    ActiveFedora::SolrService.add(coll3_attrs)
    ActiveFedora::SolrService.commit
  end

  describe "#run" do
    subject { described_class.run(work) }

    specify "should return correct collections" do
      expect(subject.length).to eq(2)
      ids = subject.map { |col| col[:id] }
      expect(ids).to include(coll1_attrs[:id])
      expect(ids).to include(coll2_attrs[:id])
      expect(ids).not_to include(coll3_attrs[:id])
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
sufia-7.4.1 spec/services/sufia/collection_member_service_spec.rb
sufia-7.4.0 spec/services/sufia/collection_member_service_spec.rb
sufia-7.3.1 spec/services/sufia/collection_member_service_spec.rb
sufia-7.3.0 spec/services/sufia/collection_member_service_spec.rb
sufia-7.3.0.rc3 spec/services/sufia/collection_member_service_spec.rb
sufia-7.3.0.rc2 spec/services/sufia/collection_member_service_spec.rb
sufia-7.3.0.rc1 spec/services/sufia/collection_member_service_spec.rb
sufia-7.2.0 spec/services/sufia/collection_member_service_spec.rb
sufia-7.1.0 spec/services/sufia/collection_member_service_spec.rb
sufia-7.0.0 spec/services/sufia/collection_member_service_spec.rb
sufia-7.0.0.rc2 spec/services/sufia/collection_member_service_spec.rb
sufia-7.0.0.rc1 spec/services/sufia/collection_member_service_spec.rb
sufia-7.0.0.beta4 spec/services/sufia/collection_member_service_spec.rb
sufia-7.0.0.beta3 spec/services/collection_member_service_spec.rb
sufia-7.0.0.beta2 spec/services/collection_member_service_spec.rb
sufia-7.0.0.beta1 spec/services/collection_member_service_spec.rb