Files
danbooru/test/factories/upload.rb
evazion 202dfe5d87 uploads: allow uploading multiple files from your computer at once.
Allow uploading multiple files from your computer at once.

The maximum limit is 100 files at once. There is still a 50MB size limit
that applies to the whole upload. This limit is at the Nginx level.

The upload widget no longer shows a thumbnail preview of the uploaded
file. This is because there isn't room for it in a multi-file upload,
and because the next page will show a preview anyway after the files are
uploaded.

Direct file uploads are processed synchronously, so they may be slow.

API change: the `POST /uploads` endpoint now expects the param to be
`upload[files][]`, not `upload[file]`.
2022-02-19 00:00:56 -06:00

28 lines
893 B
Ruby

FactoryBot.define do
factory(:upload) do
uploader factory: :user
uploader_ip_addr { "127.0.0.1" }
status { "pending" }
source { "https://cdn.donmai.us/original/d3/4e/d34e4cf0a437a5d65f8e82b7bcd02606.jpg" }
error { nil }
factory(:completed_source_upload) do
status { "completed" }
media_asset_count { 1 }
upload_media_assets { [build(:upload_media_asset, source_url: "https://example.com/file.jpg", status: "active")] }
end
factory(:completed_file_upload) do
status { "completed" }
source { nil }
media_asset_count { 1 }
files { { "0" => Rack::Test::UploadedFile.new("#{Rails.root}/test/files/test.jpg") } }
upload_media_assets do
[build(:upload_media_asset, media_asset: build(:media_asset, file: "test/files/test.jpg"), source_url: "file://test.jpg", status: "active")]
end
end
end
end