aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Claghorn <george.claghorn@gmail.com>2018-01-28 19:27:00 -0500
committerGitHub <noreply@github.com>2018-01-28 19:27:00 -0500
commite57e0a92e798d7d9cf2a37447e553ee67942526a (patch)
tree3696fcf48d6548363bf10e57d67a315046c06dfb
parent159b21b59dba120e58eeb8bff89b9d322e720c44 (diff)
parent530a79705553ab46138e25376f69f305e9527ee2 (diff)
downloadrails-e57e0a92e798d7d9cf2a37447e553ee67942526a.tar.gz
rails-e57e0a92e798d7d9cf2a37447e553ee67942526a.tar.bz2
rails-e57e0a92e798d7d9cf2a37447e553ee67942526a.zip
Merge pull request #31810 from shuheiktgw/add_tests_for_blob
Added tests for ActiveStorage::Blob#image? and ActiveStorage::Blob#video?
-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?