Sha256: 6f54e193743ed73a98b1efab4b23d77bdbd62b0d32c6909b0cc136ef06814888

Contents?: true

Size: 1.35 KB

Versions: 13

Compression:

Stored size: 1.35 KB

Contents

require 'spec_helper'

describe VisibilityCopyWorker do

  describe "an open access work" do
    let(:work) { FactoryGirl.create(:generic_work_with_files, visibility: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC) }
    subject { VisibilityCopyWorker.new(work.id) }

    it "should have no content at the outset" do
      work.generic_files.first.visibility.should == Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
    end

    it "should copy visibility to its contained files" do
      subject.run
      work.generic_files.each do |file|
        file.visibility.should == 'open'
      end
    end
  end

  describe "an embargoed work" do
    let(:embargo_date) { 2.days.from_now }
    let(:work) { FactoryGirl.create(:generic_work_with_files, visibility: Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC, embargo_release_date: embargo_date) }
    subject { VisibilityCopyWorker.new(work.id) }

    it "should have no content at the outset" do
      work.should be_open_access_with_embargo_release_date
      work.generic_files.first.should_not be_open_access_with_embargo_release_date
    end

    it "should copy visibility to its contained files" do
      subject.run
      work.reload
      work.generic_files.each do |file|
        file.should be_open_access_with_embargo_release_date
      end
    end
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
curate-0.6.6 spec/workers/visibility_copy_worker_spec.rb
curate-0.6.5 spec/workers/visibility_copy_worker_spec.rb
curate-0.6.4 spec/workers/visibility_copy_worker_spec.rb
curate-0.6.3 spec/workers/visibility_copy_worker_spec.rb
curate-0.6.1 spec/workers/visibility_copy_worker_spec.rb
curate-0.6.0 spec/workers/visibility_copy_worker_spec.rb
curate-0.5.6 spec/workers/visibility_copy_worker_spec.rb
curate-0.5.5 spec/workers/visibility_copy_worker_spec.rb
curate-0.5.4 spec/workers/visibility_copy_worker_spec.rb
curate-0.5.2 spec/workers/visibility_copy_worker_spec.rb
curate-0.5.1 spec/workers/visibility_copy_worker_spec.rb
curate-0.5.0 spec/workers/visibility_copy_worker_spec.rb
curate-0.4.2 spec/workers/visibility_copy_worker_spec.rb