summaryrefslogtreecommitdiff
path: root/spec/support/upload_helpers.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-12-18 23:43:13 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2016-12-18 23:43:13 +0100
commitc1928f4fce2c1b6315723f8b4a2002eee094b477 (patch)
tree01c061f90c8513e45554953414cfbd0d6f007149 /spec/support/upload_helpers.rb
parent1e62a13968cc4351684f919630cd426e20fc022a (diff)
parent546fa165ff728bc2d25ed9b55b95dd1d48139d4a (diff)
downloadgitlab-ce-improve-pipeline-fixtures.tar.gz
Merge remote-tracking branch 'origin/master' into improve-pipeline-fixturesimprove-pipeline-fixtures
Diffstat (limited to 'spec/support/upload_helpers.rb')
-rw-r--r--spec/support/upload_helpers.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/support/upload_helpers.rb b/spec/support/upload_helpers.rb
new file mode 100644
index 00000000000..5eead80c935
--- /dev/null
+++ b/spec/support/upload_helpers.rb
@@ -0,0 +1,16 @@
+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