diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-30 03:09:37 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-30 03:09:37 +0300 |
commit | 0ec841b7f902243b832f11b352f215bd93bc680b (patch) | |
tree | efc80df932176a4d9e99377acf720fcdd5f2bf0a /spec/support/renameable_upload.rb | |
parent | 82f5f2485b37ea938d11181f3e05ddf35ab1959e (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 |