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:
parent
c045637c94
commit
530a797055
1 changed files with 12 additions and 0 deletions
|
@ -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?
|
||||
|
|
Loading…
Reference in a new issue