Sha256: 930938ebfac28d62dba82e606566d1a43bd4f4f6ca78e6f0f68b1e359f4a24d8

Contents?: true

Size: 1.14 KB

Versions: 14

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'
describe CurationConcerns::AddToCollectionActor do
  let(:user) { create(:user) }
  let(:curation_concern) { GenericWork.new }
  let(:attributes) { {} }
  subject do
    CurationConcerns::ActorStack.new(curation_concern,
                                     user,
                                     [described_class,
                                      CurationConcerns::GenericWorkActor])
  end
  describe 'the next actor' do
    let(:root_actor) { double }
    before do
      allow(CurationConcerns::RootActor).to receive(:new).and_return(root_actor)
    end

    let(:attributes) do
      { collection_ids: ['123'], title: ['test'] }
    end

    it 'does not receive the collection_ids' do
      expect(root_actor).to receive(:create).with(title: ['test'])
      subject.create(attributes)
    end
  end

  describe 'create' do
    let(:collection) { create(:collection) }
    let(:attributes) do
      { collection_ids: [collection.id], title: ['test'] }
    end

    it 'adds it to the collection' do
      expect(subject.create(attributes)).to be true
      expect(collection.reload.members).to eq [curation_concern]
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
curation_concerns-1.0.0.beta1 spec/actors/curation_concerns/add_to_collections_actor_spec.rb
curation_concerns-0.14.0 spec/actors/curation_concerns/add_to_collections_actor_spec.rb
curation_concerns-0.14.0.pre4 spec/actors/curation_concerns/add_to_collections_actor_spec.rb
curation_concerns-0.14.0.pre3 spec/actors/curation_concerns/add_to_collections_actor_spec.rb
curation_concerns-0.14.0.pre2 spec/actors/curation_concerns/add_to_collections_actor_spec.rb
curation_concerns-0.14.0.pre1 spec/actors/curation_concerns/add_to_collections_actor_spec.rb
curation_concerns-0.13.1 spec/actors/curation_concerns/add_to_collections_actor_spec.rb
curation_concerns-0.13.0 spec/actors/curation_concerns/add_to_collections_actor_spec.rb
curation_concerns-0.12.0 spec/actors/curation_concerns/add_to_collections_actor_spec.rb
curation_concerns-0.12.0.pre9 spec/actors/curation_concerns/add_to_collections_actor_spec.rb
curation_concerns-0.12.0.pre8 spec/actors/curation_concerns/add_to_collections_actor_spec.rb
curation_concerns-0.12.0.pre7 spec/actors/curation_concerns/add_to_collections_actor_spec.rb
curation_concerns-0.12.0.pre6 spec/actors/curation_concerns/add_to_collections_actor_spec.rb
curation_concerns-0.12.0.pre5 spec/actors/curation_concerns/add_to_collections_actor_spec.rb