gitlab-org--gitlab-foss/spec/support/helpers/upload_helpers.rb
Rémy Coutable 023d4f6f2f
Move spec helpers/matchers/shared examples/contexts to their relevant folder
Signed-off-by: Rémy Coutable <remy@rymai.me>
2018-04-23 12:20:30 +02:00

16 lines
478 B
Ruby

require 'fileutils'
module UploadHelpers
extend self
def uploaded_image_temp_path
basename = 'banana_sample.gif'
orig_path = File.join(Rails.root, 'spec', 'fixtures', basename)
tmp_path = File.join(Rails.root, 'tmp', 'tests', basename)
# Because we use 'move_to_store' on all uploaders, we create a new
# tempfile on each call: the file we return here will be renamed in most
# cases.
FileUtils.copy(orig_path, tmp_path)
tmp_path
end
end