Add MediaAsset model.
A MediaAsset represents an image or video file uploaded to Danbooru. It stores the metadata associated with the image or video. This is to work on decoupling files from posts so that images can be uploaded separately from posts.
This commit is contained in:
@@ -937,6 +937,17 @@ class UploadServiceTest < ActiveSupport::TestCase
|
||||
assert_equal([], post.errors.full_messages)
|
||||
assert_not_nil(post.id)
|
||||
end
|
||||
|
||||
should "create a media asset" do
|
||||
post = subject.new({}).create_post_from_upload(@upload)
|
||||
|
||||
assert_not_nil(post.media_asset)
|
||||
assert_equal("12345", post.media_asset.md5)
|
||||
assert_equal("jpg", post.media_asset.file_ext)
|
||||
assert_equal(1000, post.media_asset.file_size)
|
||||
assert_equal(100, post.media_asset.image_width)
|
||||
assert_equal(100, post.media_asset.image_height)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user