Sha256: be0ed149917ddf6143136be02b6bd842e2e7f9021858df8ac821b194aa951602

Contents?: true

Size: 1.83 KB

Versions: 16

Compression:

Stored size: 1.83 KB

Contents

describe "sufia_events using CurationConcerns callbacks" do
  let(:curation_concern) { create(:work) }
  let(:file_set) { create(:file_set) }
  let(:user) { create(:user) }

  describe "after_create_concern" do
    it "queues a ContentDepositEventJob" do
      expect(ContentDepositEventJob).to receive(:perform_later).with(curation_concern, user)
      CurationConcerns.config.callback.run(:after_create_concern, curation_concern, user)
    end
  end

  describe "after_create_fileset" do
    it "queues a FileSetAttachedEventJob" do
      expect(FileSetAttachedEventJob).to receive(:perform_later).with(file_set, user)
      CurationConcerns.config.callback.run(:after_create_fileset, file_set, user)
    end
  end

  describe "after_revert_content" do
    let(:revision) { "revision1" }
    it "queues a ContentRestoredVersionEventJob" do
      expect(ContentRestoredVersionEventJob).to receive(:perform_later).with(file_set, user, revision)
      CurationConcerns.config.callback.run(:after_revert_content, file_set, user, revision)
    end
  end

  describe "after_update_content" do
    it "queues a ContentNewVersionEventJob" do
      expect(ContentNewVersionEventJob).to receive(:perform_later).with(file_set, user)
      CurationConcerns.config.callback.run(:after_update_content, file_set, user)
    end
  end

  describe "after_update_metadata" do
    it "queues a ContentUpdateEventJob" do
      expect(ContentUpdateEventJob).to receive(:perform_later).with(curation_concern, user)
      CurationConcerns.config.callback.run(:after_update_metadata, curation_concern, user)
    end
  end

  describe "after_destroy" do
    let(:id) { curation_concern.id }
    it "queues a ContentDeleteEventJob" do
      expect(ContentDeleteEventJob).to receive(:perform_later).with(id, user)
      CurationConcerns.config.callback.run(:after_destroy, id, user)
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

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