aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage
diff options
context:
space:
mode:
authorShuhei Kitagawa <shuhei.kitagawa@c-fo.com>2018-01-28 16:17:37 +0900
committerShuhei Kitagawa <shuhei.kitagawa@c-fo.com>2018-01-29 09:02:17 +0900
commit530a79705553ab46138e25376f69f305e9527ee2 (patch)
tree6a7afa07c4c2fd7573cdcb35b20f753cef0adf9a /activestorage
parentc045637c94b702ab7ae4d624cc8f97087826c548 (diff)
downloadrails-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')
-rw-r--r--activestorage/test/models/blob_test.rb12
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?