2019-04-30 08:27:42 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-06-17 08:46:42 +08:00
|
|
|
Fabricator(:upload) do
|
|
|
|
user
|
2016-07-01 15:22:30 +08:00
|
|
|
sha1 { sequence(:sha1) { |n| Digest::SHA1.hexdigest(n.to_s) } }
|
2014-04-15 04:55:57 +08:00
|
|
|
original_filename "logo.png"
|
2013-06-17 08:46:42 +08:00
|
|
|
filesize 1234
|
|
|
|
width 100
|
|
|
|
height 200
|
2018-10-04 22:00:07 +08:00
|
|
|
thumbnail_width 30
|
|
|
|
thumbnail_height 60
|
2018-09-14 13:42:59 +08:00
|
|
|
|
|
|
|
url do |attrs|
|
|
|
|
sequence(:url) do |n|
|
|
|
|
Discourse.store.get_path_for(
|
|
|
|
"original", n + 1, attrs[:sha1], ".#{attrs[:extension]}"
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-07-04 01:08:59 +08:00
|
|
|
extension "png"
|
2013-06-17 08:46:42 +08:00
|
|
|
end
|
2013-07-11 04:59:07 +08:00
|
|
|
|
2017-05-23 00:37:01 +08:00
|
|
|
Fabricator(:upload_s3, from: :upload) do
|
2018-09-14 13:42:59 +08:00
|
|
|
url do |attrs|
|
|
|
|
sequence(:url) do |n|
|
|
|
|
File.join(
|
|
|
|
Discourse.store.absolute_base_url,
|
|
|
|
Discourse.store.get_path_for(
|
|
|
|
"original", n + 1, attrs[:sha1], ".#{attrs[:extension]}"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
2013-07-11 04:59:07 +08:00
|
|
|
end
|