Sha256: 60fb73a0e40b899115f455f89e5f8fbb94e89e73393ae760a8de15f9fa8ff9fb
Contents?: true
Size: 1.42 KB
Versions: 44
Compression:
Stored size: 1.42 KB
Contents
require 'spec_helper' describe Hydra::EmbargoService do let(:future_date) { 2.days.from_now } let(:past_date) { 2.days.ago } let!(:work_with_expired_embargo1) do FactoryGirl.build(:asset, embargo_release_date: past_date.to_s).tap do |work| work.save(validate:false) end end let!(:work_with_expired_embargo2) do FactoryGirl.build(:asset, embargo_release_date: past_date.to_s).tap do |work| work.save(validate:false) end end let!(:work_with_embargo_in_effect) { FactoryGirl.create(:asset, embargo_release_date: future_date.to_s)} let!(:work_without_embargo) { FactoryGirl.create(:asset)} describe "#assets_with_expired_embargoes" do it "returns an array of assets with expired embargoes" do returned_ids = subject.assets_with_expired_embargoes.map {|a| a.id} expect(returned_ids).to include work_with_expired_embargo1.id, work_with_expired_embargo2.id expect(returned_ids).to_not include work_with_embargo_in_effect.id, work_without_embargo.id end end describe "#assets_under_embargo" do it "returns all assets with embargo release date set" do result = subject.assets_under_embargo returned_ids = subject.assets_under_embargo.map {|a| a.id} expect(returned_ids).to include work_with_expired_embargo1.id, work_with_expired_embargo2.id, work_with_embargo_in_effect.id expect(returned_ids).to_not include work_without_embargo.id end end end
Version data entries
44 entries across 44 versions & 1 rubygems