1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add a test for ActiveStorage::Blob#image? and ActiveStorage::Blob#video?

This commit is contained in:
Shuhei Kitagawa 2018-01-28 16:17:37 +09:00
parent c045637c94
commit 530a797055

View file

@ -23,6 +23,18 @@ class ActiveStorage::BlobTest < ActiveSupport::TestCase
assert_equal "text/plain", blob.content_type
end
test "image?" do
blob = create_file_blob filename: "racecar.jpg"
assert_predicate blob, :image?
assert_not_predicate blob, :audio?
end
test "video?" do
blob = create_file_blob(filename: "video.mp4", content_type: "video/mp4")
assert_predicate blob, :video?
assert_not_predicate blob, :audio?
end
test "text?" do
blob = create_blob data: "Hello world!"
assert_predicate blob, :text?