debian-mirror-gitlab/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

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
FactoryBot.define do
2016-06-02 11:05:42 +05:30
factory :file_uploader do
2017-09-10 17:25:29 +05:30
skip_create
project
2019-12-21 20:55:43 +05:30
secret { nil }
2016-06-02 11:05:42 +05:30
transient do
fixture { 'rails_sample.jpg' }
path { File.join(Rails.root, 'spec/fixtures', fixture) }
file { Rack::Test::UploadedFile.new(path) }
end
after(:build) do |uploader, evaluator|
2020-11-24 15:15:51 +05:30
uploader.store!(evaluator.file) if evaluator.project&.persisted?
2016-06-02 11:05:42 +05:30
end
initialize_with do
new(project, secret)
end
end
end