Sha256: d566ab75eb551b71d6c10da7a7f9591d905a161c322815c7d4d13dc7c1011b9e

Contents?: true

Size: 1.68 KB

Versions: 8

Compression:

Stored size: 1.68 KB

Contents

describe Sufia::ActorFactory do
  let(:work) { GenericWork.new }
  let(:user) { double }

  describe '.stack_actors' do
    subject { described_class.stack_actors(work) }
    it { is_expected.to eq [Sufia::CreateWithRemoteFilesActor,
                            Sufia::CreateWithFilesActor,
                            CurationConcerns::Actors::AddToCollectionActor,
                            CurationConcerns::Actors::AddToWorkActor,
                            CurationConcerns::Actors::AssignRepresentativeActor,
                            CurationConcerns::Actors::AttachFilesActor,
                            CurationConcerns::Actors::ApplyOrderActor,
                            CurationConcerns::Actors::InterpretVisibilityActor,
                            CurationConcerns::Actors::GenericWorkActor] }
  end

  describe '.build' do
    subject { described_class.build(work, user) }
    it "has the correct stack frames" do
      expect(subject.more_actors).to eq [
        Sufia::CreateWithFilesActor,
        CurationConcerns::Actors::AddToCollectionActor,
        CurationConcerns::Actors::AddToWorkActor,
        CurationConcerns::Actors::AssignRepresentativeActor,
        CurationConcerns::Actors::AttachFilesActor,
        CurationConcerns::Actors::ApplyOrderActor,
        CurationConcerns::Actors::InterpretVisibilityActor,
        CurationConcerns::Actors::GenericWorkActor
      ]
      expect(subject.first_actor_class).to eq Sufia::CreateWithRemoteFilesActor
    end
  end

  describe 'CurationConcerns::CurationConcern.actor' do
    it "calls the Sufia::ActorFactory" do
      expect(described_class).to receive(:build)
      CurationConcerns::CurationConcern.actor(work, user)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sufia-7.1.0 spec/services/sufia/actor_factory_spec.rb
sufia-7.0.0 spec/services/sufia/actor_factory_spec.rb
sufia-7.0.0.rc2 spec/services/sufia/actor_factory_spec.rb
sufia-7.0.0.rc1 spec/services/sufia/actor_factory_spec.rb
sufia-7.0.0.beta4 spec/services/sufia/actor_factory_spec.rb
sufia-7.0.0.beta3 spec/services/sufia/actor_factory_spec.rb
sufia-7.0.0.beta2 spec/services/sufia/actor_factory_spec.rb
sufia-7.0.0.beta1 spec/services/sufia/actor_factory_spec.rb