Sha256: d531740a23932665deab4771b6e0b0c9ac93486400f1d3e5d71fcd9969ea76c1

Contents?: true

Size: 911 Bytes

Versions: 64

Compression:

Stored size: 911 Bytes

Contents

FactoryGirl.define do
  # The ::FileSet model is defined in .internal_test_app/app/models by the
  # curation_concerns:install generator.
  factory :file_set, class: FileSet do
    transient do
      user { FactoryGirl.create(:user) }
      content nil
    end

    after(:create) do |file, evaluator|
      if evaluator.content
        Hydra::Works::UploadFileToFileSet.call(file, evaluator.content)
      end
    end

    factory :file_with_work do
      after(:build) do |file, _evaluator|
        file.title = ['testfile']
      end
      after(:create) do |file, evaluator|
        if evaluator.content
          Hydra::Works::UploadFileToFileSet.call(file, evaluator.content)
        end
        FactoryGirl.create(:generic_work, user: evaluator.user).members << file
      end
    end

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

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
curation_concerns-1.7.8 spec/factories/file_sets.rb
curation_concerns-1.7.7 spec/factories/file_sets.rb
curation_concerns-2.0.0 spec/factories/file_sets.rb
curation_concerns-2.0.0.rc2 spec/factories/file_sets.rb
curation_concerns-1.7.6 spec/factories/file_sets.rb
curation_concerns-1.7.5 spec/factories/file_sets.rb
curation_concerns-1.7.4 spec/factories/file_sets.rb
curation_concerns-1.7.3 spec/factories/file_sets.rb
curation_concerns-1.7.2 spec/factories/file_sets.rb
curation_concerns-2.0.0.rc1 spec/factories/file_sets.rb
curation_concerns-1.7.1 spec/factories/file_sets.rb
curation_concerns-1.7.0 spec/factories/file_sets.rb
curation_concerns-1.7.0.beta1 spec/factories/file_sets.rb
curation_concerns-1.6.3 spec/factories/file_sets.rb
curation_concerns-1.6.2 spec/factories/file_sets.rb
curation_concerns-1.6.1 spec/factories/file_sets.rb
curation_concerns-1.6.0 spec/factories/file_sets.rb
curation_concerns-1.5.0 spec/factories/file_sets.rb
curation_concerns-1.4.0 spec/factories/file_sets.rb
curation_concerns-1.3.3 spec/factories/file_sets.rb