tests: fix upload tests.
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
require 'fileutils'
|
||||
|
||||
FactoryGirl.define do
|
||||
factory(:upload) do
|
||||
rating "s"
|
||||
@@ -15,51 +13,10 @@ FactoryGirl.define do
|
||||
end
|
||||
|
||||
factory(:jpg_upload) do
|
||||
content_type "image/jpeg"
|
||||
file do
|
||||
f = Tempfile.new
|
||||
f.write(File.read("#{Rails.root}/test/files/test.jpg"))
|
||||
f.seek(0)
|
||||
f
|
||||
end
|
||||
end
|
||||
|
||||
factory(:exif_jpg_upload) do
|
||||
content_type "image/jpeg"
|
||||
file_path do
|
||||
FileUtils.cp("#{Rails.root}/test/files/test-exif-small.jpg", "#{Rails.root}/tmp")
|
||||
"#{Rails.root}/tmp/test-exif-small.jpg"
|
||||
end
|
||||
end
|
||||
|
||||
factory(:blank_jpg_upload) do
|
||||
content_type "image/jpeg"
|
||||
file_path do
|
||||
FileUtils.cp("#{Rails.root}/test/files/test-blank.jpg", "#{Rails.root}/tmp")
|
||||
"#{Rails.root}/tmp/test-blank.jpg"
|
||||
end
|
||||
end
|
||||
|
||||
factory(:large_jpg_upload) do
|
||||
file_ext "jpg"
|
||||
content_type "image/jpeg"
|
||||
file_path do
|
||||
FileUtils.cp("#{Rails.root}/test/files/test-large.jpg", "#{Rails.root}/tmp")
|
||||
"#{Rails.root}/tmp/test-large.jpg"
|
||||
end
|
||||
end
|
||||
|
||||
factory(:png_upload) do
|
||||
file_path do
|
||||
FileUtils.cp("#{Rails.root}/test/files/test.png", "#{Rails.root}/tmp")
|
||||
"#{Rails.root}/tmp/test.png"
|
||||
end
|
||||
end
|
||||
|
||||
factory(:gif_upload) do
|
||||
file_path do
|
||||
FileUtils.cp("#{Rails.root}/test/files/test.gif", "#{Rails.root}/tmp")
|
||||
"#{Rails.root}/tmp/test.gif"
|
||||
IO.copy_stream("#{Rails.root}/test/files/test.jpg", f.path)
|
||||
ActionDispatch::Http::UploadedFile.new(tempfile: f, filename: "test.jpg")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user