diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-11 18:09:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-11 18:09:11 +0300 |
commit | 5231344d99fd052e193243041dc180ed26cfe2ac (patch) | |
tree | f9e518b857c8e77bde98d73291107ab410938fee /spec/support/renameable_upload.rb | |
parent | 9f5ac379c76c278ee9ee1662e26c4612b0a117bd (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/renameable_upload.rb')
-rw-r--r-- | spec/support/renameable_upload.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/support/renameable_upload.rb b/spec/support/renameable_upload.rb new file mode 100644 index 00000000000..f7f00181605 --- /dev/null +++ b/spec/support/renameable_upload.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class RenameableUpload < SimpleDelegator + attr_accessor :original_filename + + # Get a fixture file with a new unique name, and the same extension + def self.unique_file(name) + upload = new(fixture_file_upload("spec/fixtures/#{name}")) + ext = File.extname(name) + new_name = File.basename(FactoryBot.generate(:filename), '.*') + upload.original_filename = new_name + ext + + upload + end +end |