Sha256: 7566933810269c2eb6a379233cc38b7b3ea91929824408d45df39244cca96e84

Contents?: true

Size: 1.29 KB

Versions: 29

Compression:

Stored size: 1.29 KB

Contents

require 'spec_helper'

describe CurationConcerns::EmbargoActor do
  let(:actor) { described_class.new(work) }

  let(:work) do
    GenericWork.new do |work|
      work.apply_depositor_metadata 'foo'
      work.title = ["test"]
      work.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
      work.visibility_during_embargo = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
      work.visibility_after_embargo = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
      work.embargo_release_date = release_date.to_s
      work.save(validate: false)
    end
  end

  describe "#destroy" do
    context "with an active embargo" do
      let(:release_date) { Date.today + 2 }

      it "removes the embargo" do
        actor.destroy
        expect(work.reload.embargo_release_date).to be_nil
        expect(work.visibility).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
      end
    end

    context 'with an expired embargo' do
      let(:release_date) { Date.today - 2 }
      it "removes the embargo" do
        actor.destroy
        expect(work.reload.embargo_release_date).to be_nil
        expect(work.visibility).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

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