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.3.2 spec/factories/file_sets.rb
curation_concerns-1.3.1 spec/factories/file_sets.rb
curation_concerns-1.3.0 spec/factories/file_sets.rb
curation_concerns-1.2.0 spec/factories/file_sets.rb
curation_concerns-1.1.2 spec/factories/file_sets.rb
curation_concerns-1.1.1 spec/factories/file_sets.rb
curation_concerns-1.1.0 spec/factories/file_sets.rb
curation_concerns-1.0.0 spec/factories/file_sets.rb
curation_concerns-1.0.0.beta10 spec/factories/file_sets.rb
curation_concerns-1.0.0.beta9 spec/factories/file_sets.rb
curation_concerns-1.0.0.beta8 spec/factories/file_sets.rb
curation_concerns-1.0.0.beta7 spec/factories/file_sets.rb
curation_concerns-1.0.0.beta6 spec/factories/file_sets.rb
curation_concerns-1.0.0.beta5 spec/factories/file_sets.rb
curation_concerns-1.0.0.beta4 spec/factories/file_sets.rb
curation_concerns-1.0.0.beta3 spec/factories/file_sets.rb
curation_concerns-1.0.0.beta2 spec/factories/file_sets.rb
curation_concerns-1.0.0.beta1 spec/factories/file_sets.rb
curation_concerns-0.14.0 spec/factories/file_sets.rb
curation_concerns-0.14.0.pre4 spec/factories/file_sets.rb