summaryrefslogtreecommitdiff
path: root/spec/support/upload_helpers.rb
blob: 5eead80c935d7121d1f3a8dd2df2190679d69624 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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