Sha256: 56fd783bddd7287b594a8b7c591b6fb497b7e117ea87cee238e55b2c18084124

Contents?: true

Size: 910 Bytes

Versions: 8

Compression:

Stored size: 910 Bytes

Contents

FactoryGirl.define do
  factory :work, aliases: [:generic_work, :private_generic_work], class: GenericWork do
    transient do
      user { FactoryGirl.create(:user) }
    end

    title ["Test title"]
    visibility Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE

    after(:build) do |work, evaluator|
      work.apply_depositor_metadata(evaluator.user.user_key)
    end

    factory :public_generic_work, aliases: [:public_work], traits: [:public]

    trait :public do
      visibility Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
    end

    factory :registered_generic_work do
      read_groups ["registered"]
    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'], label: 'filename.pdf')
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sufia-7.4.1 spec/factories/generic_works.rb
sufia-7.4.0 spec/factories/generic_works.rb
sufia-7.3.1 spec/factories/generic_works.rb
sufia-7.3.0 spec/factories/generic_works.rb
sufia-7.3.0.rc3 spec/factories/generic_works.rb
sufia-7.3.0.rc2 spec/factories/generic_works.rb
sufia-7.3.0.rc1 spec/factories/generic_works.rb
sufia-7.2.0 spec/factories/generic_works.rb