gitlab-org--gitlab-foss/spec/factories/file_uploaders.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
496 B
Ruby
Raw Normal View History

# frozen_string_literal: true
FactoryBot.define do
2016-03-31 03:43:47 -04:00
factory :file_uploader do
skip_create
project
secret { nil }
transient do
2016-03-31 03:43:47 -04:00
fixture { 'rails_sample.jpg' }
path { File.join(Rails.root, 'spec/fixtures', fixture) }
file { Rack::Test::UploadedFile.new(path) }
end
after(:build) do |uploader, evaluator|
uploader.store!(evaluator.file) if evaluator.project&.persisted?
end
initialize_with do
new(project, secret)
end
end
end