Sha256: 96a7e9fcfd38dc4078ebd9589c6aedca45000d2a27c1c16ef4405c75a5ca67a3

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'
describe CurationConcerns::Actors::GrantEditToDepositorActor, :workflow do
  let(:user) { create(:user) }
  let(:curation_concern) { GenericWork.new }
  let(:attributes) { { title: ['test'] } }

  subject do
    CurationConcerns::Actors::ActorStack.new(curation_concern,
                                             user,
                                             [described_class,
                                              CurationConcerns::Actors::GenericWorkActor])
  end

  describe 'the next actor' do
    let(:root_actor) { double }
    before do
      allow(CurationConcerns::Actors::RootActor).to receive(:new).and_return(root_actor)
    end

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

  describe 'create' do
    it 'gives the creator depositor access' do
      expect(subject.create(attributes)).to be true
      expect(curation_concern.edit_users).to eq [user.user_key]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
curation_concerns-1.7.0.beta1 spec/actors/curation_concerns/grant_edit_to_depositor_actor_spec.rb