spec/factories/generic_works.rb in curation_concerns-1.6.3 vs spec/factories/generic_works.rb in curation_concerns-1.7.0.beta1

- old
+ new

@@ -13,14 +13,20 @@ work.apply_depositor_metadata(evaluator.user.user_key) end factory :public_generic_work, traits: [:public] + factory :authenticated_generic_work, traits: [:authenticated] + trait :public do visibility Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC end + trait :authenticated do + visibility Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED + end + factory :work_with_one_file do before(:create) do |work, evaluator| work.ordered_members << FactoryGirl.create(:file_set, user: evaluator.user, title: ['A Contained FileSet']) end end @@ -64,25 +70,32 @@ end factory :with_embargo_date do transient do embargo_date { Date.tomorrow.to_s } + current_state { Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE } + future_state { Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC } end factory :embargoed_work do - after(:build) { |work, evaluator| work.apply_embargo(evaluator.embargo_date, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC) } + after(:build) { |work, evaluator| work.apply_embargo(evaluator.embargo_date, evaluator.current_state, evaluator.future_state) } end - factory :embargoed_work_with_files do - after(:build) { |work, evaluator| work.apply_embargo(evaluator.embargo_date, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC) } + after(:build) { |work, evaluator| work.apply_embargo(evaluator.embargo_date, evaluator.current_state, evaluator.future_state) } after(:create) { |work, evaluator| 2.times { work.ordered_members << FactoryGirl.create(:file_set, user: evaluator.user) } } end + end + factory :with_lease_date do + transient do + lease_date { Date.tomorrow.to_s } + current_state { Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC } + future_state { Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE } + end factory :leased_work do - after(:build) { |work, evaluator| work.apply_lease(evaluator.embargo_date, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE) } + after(:build) { |work, evaluator| work.apply_lease(evaluator.lease_date, evaluator.current_state, evaluator.future_state) } end - factory :leased_work_with_files do - after(:build) { |work, evaluator| work.apply_lease(evaluator.embargo_date, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE) } + after(:build) { |work, evaluator| work.apply_lease(evaluator.lease_date, evaluator.current_state, evaluator.future_state) } after(:create) { |work, evaluator| 2.times { work.ordered_members << FactoryGirl.create(:file_set, user: evaluator.user) } } end end end end