Sha256: d41d230e329ad3aa8bcd438432a63b96aa42991615c983549c24fd734d5abf97

Contents?: true

Size: 1.05 KB

Versions: 10

Compression:

Stored size: 1.05 KB

Contents

FactoryGirl.define do
  factory :generic_work do
    ignore do
      user {FactoryGirl.create(:user)}
    end
    sequence(:title) {|n| "Title #{n}"}
    rights { Sufia.config.cc_licenses.keys.first.dup }
    date_uploaded { Date.today }
    date_modified { Date.today }
    visibility Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
    before(:create) { |work, evaluator|
      work.apply_depositor_metadata(evaluator.user.user_key)
      work.owner = evaluator.user.user_key
      work.contributors << FactoryGirl.create(:person)
    }

    factory :private_generic_work do
      visibility Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
    end
    factory :public_generic_work do
      visibility Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
    end
    factory :generic_work_with_files do
      ignore do
        file_count 3
      end

      after(:create) do |work, evaluator|
        FactoryGirl.create_list(:generic_file, evaluator.file_count, batch: work, user: evaluator.user)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
curate-0.6.6 spec/factories/generic_works_factory.rb
curate-0.6.5 spec/factories/generic_works_factory.rb
curate-0.6.4 spec/factories/generic_works_factory.rb
curate-0.6.3 spec/factories/generic_works_factory.rb
curate-0.6.1 spec/factories/generic_works_factory.rb
curate-0.6.0 spec/factories/generic_works_factory.rb
curate-0.5.6 spec/factories/generic_works_factory.rb
curate-0.5.5 spec/factories/generic_works_factory.rb
curate-0.5.4 spec/factories/generic_works_factory.rb
curate-0.5.2 spec/factories/generic_works_factory.rb