diff options
author | Shuhei Kitagawa <shuhei.kitagawa@c-fo.com> | 2018-01-28 16:17:37 +0900 |
---|---|---|
committer | Shuhei Kitagawa <shuhei.kitagawa@c-fo.com> | 2018-01-29 09:02:17 +0900 |
commit | 530a79705553ab46138e25376f69f305e9527ee2 (patch) | |
tree | 6a7afa07c4c2fd7573cdcb35b20f753cef0adf9a /activestorage/test | |
parent | c045637c94b702ab7ae4d624cc8f97087826c548 (diff) | |
download | rails-530a79705553ab46138e25376f69f305e9527ee2.tar.gz rails-530a79705553ab46138e25376f69f305e9527ee2.tar.bz2 rails-530a79705553ab46138e25376f69f305e9527ee2.zip |
Add a test for ActiveStorage::Blob#image? and ActiveStorage::Blob#video?
Diffstat (limited to 'activestorage/test')
-rw-r--r-- | activestorage/test/models/blob_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activestorage/test/models/blob_test.rb b/activestorage/test/models/blob_test.rb index 44b60e5cbb..664939dfa7 100644 --- a/activestorage/test/models/blob_test.rb +++ b/activestorage/test/models/blob_test.rb @@ -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? |