Sha256: bf461a94481cdfa19b8c3f5ff658d84f518234317d85532ac293a2212c1b86af

Contents?: true

Size: 1.17 KB

Versions: 29

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

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

  let(:work) do
    GenericWork.new do |work|
      work.apply_depositor_metadata 'foo'
      work.title = ["test"]
      work.visibility_during_lease = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
      work.visibility_after_lease = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
      work.lease_expiration_date = release_date.to_s
      work.save(validate: false)
    end
  end

  describe "#destroy" do
    before do
      actor.destroy
    end

    context "with an active lease" do
      let(:release_date) { Date.today + 2 }

      it "removes the lease" do
        expect(work.reload.lease_expiration_date).to be_nil
        expect(work.visibility).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
      end
    end

    context 'with an expired lease' do
      let(:release_date) { Date.today - 2 }
      it "removes the lease" do
        expect(work.reload.lease_expiration_date).to be_nil
        expect(work.visibility).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
      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/lease_actor_spec.rb
curation_concerns-0.14.0 spec/actors/curation_concerns/lease_actor_spec.rb
curation_concerns-0.14.0.pre4 spec/actors/curation_concerns/lease_actor_spec.rb
curation_concerns-0.14.0.pre3 spec/actors/curation_concerns/lease_actor_spec.rb
curation_concerns-0.14.0.pre2 spec/actors/curation_concerns/lease_actor_spec.rb
curation_concerns-0.14.0.pre1 spec/actors/curation_concerns/lease_actor_spec.rb
curation_concerns-0.13.1 spec/actors/curation_concerns/lease_actor_spec.rb
curation_concerns-0.13.0 spec/actors/curation_concerns/lease_actor_spec.rb
curation_concerns-0.12.0 spec/actors/curation_concerns/lease_actor_spec.rb
curation_concerns-0.12.0.pre9 spec/actors/curation_concerns/lease_actor_spec.rb
curation_concerns-0.12.0.pre8 spec/actors/curation_concerns/lease_actor_spec.rb
curation_concerns-0.12.0.pre7 spec/actors/curation_concerns/lease_actor_spec.rb
curation_concerns-0.12.0.pre6 spec/actors/curation_concerns/lease_actor_spec.rb
curation_concerns-0.12.0.pre5 spec/actors/curation_concerns/lease_actor_spec.rb
curation_concerns-0.12.0.pre4 spec/actors/curation_concerns/lease_actor_spec.rb
curation_concerns-0.12.0.pre3 spec/actors/curation_concerns/lease_actor_spec.rb
curation_concerns-0.12.0.pre2 spec/actors/curation_concerns/lease_actor_spec.rb
curation_concerns-0.12.0.pre1 spec/actors/curation_concerns/lease_actor_spec.rb
curation_concerns-0.11.0 spec/actors/curation_concerns/lease_actor_spec.rb
curation_concerns-0.11.0.rc1 spec/actors/curation_concerns/lease_actor_spec.rb