summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2016-08-18 16:31:44 +0200
committerJacob Vosmaer <jacob@gitlab.com>2016-12-15 12:26:36 +0100
commit6731ab5d76c34462f0b4424ff03c9646ad916b76 (patch)
tree0fc3f62485f5dfdf36d02e6407bba7640ea87aef /spec/support
parent01ffcceb81f1a556cdce15ec89c15be12dba9732 (diff)
downloadgitlab-ce-6731ab5d76c34462f0b4424ff03c9646ad916b76.tar.gz
Add Gitlab::Middleware::Multipart
Diffstat (limited to 'spec/support')
-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