2019-04-29 20:27:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-06-16 20:46:42 -04:00
|
|
|
Fabricator(:upload) do
|
|
|
|
user
|
2016-07-01 03:22:30 -04:00
|
|
|
sha1 { sequence(:sha1) { |n| Digest::SHA1.hexdigest(n.to_s) } }
|
2014-04-14 16:55:57 -04:00
|
|
|
original_filename "logo.png"
|
2013-06-16 20:46:42 -04:00
|
|
|
filesize 1234
|
|
|
|
width 100
|
|
|
|
height 200
|
2018-10-04 10:00:07 -04:00
|
|
|
thumbnail_width 30
|
|
|
|
thumbnail_height 60
|
2018-09-14 01:42:59 -04:00
|
|
|
|
|
|
|
url do |attrs|
|
|
|
|
sequence(:url) do |n|
|
|
|
|
Discourse.store.get_path_for(
|
|
|
|
"original", n + 1, attrs[:sha1], ".#{attrs[:extension]}"
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-07-03 13:08:59 -04:00
|
|
|
extension "png"
|
2013-06-16 20:46:42 -04:00
|
|
|
end
|
2013-07-10 16:59:07 -04:00
|
|
|
|
2019-07-16 08:35:17 -04:00
|
|
|
Fabricator(:video_upload, from: :upload) do
|
|
|
|
original_filename "video.mp4"
|
|
|
|
width nil
|
|
|
|
height nil
|
|
|
|
thumbnail_width nil
|
|
|
|
thumbnail_height nil
|
|
|
|
extension "mp4"
|
|
|
|
end
|
|
|
|
|
2017-05-22 12:37:01 -04:00
|
|
|
Fabricator(:upload_s3, from: :upload) do
|
2018-09-14 01:42:59 -04:00
|
|
|
url do |attrs|
|
|
|
|
sequence(:url) do |n|
|
2019-05-30 02:38:46 -04:00
|
|
|
path = +Discourse.store.get_path_for(
|
|
|
|
"original", n + 1, attrs[:sha1], ".#{attrs[:extension]}"
|
2018-09-14 01:42:59 -04:00
|
|
|
)
|
2019-05-30 02:38:46 -04:00
|
|
|
|
|
|
|
if Rails.configuration.multisite
|
|
|
|
path.prepend(File.join(Discourse.store.upload_path, "/"))
|
|
|
|
end
|
|
|
|
|
|
|
|
File.join(Discourse.store.absolute_base_url, path)
|
2018-09-14 01:42:59 -04:00
|
|
|
end
|
|
|
|
end
|
2013-07-10 16:59:07 -04:00
|
|
|
end
|