From 530a79705553ab46138e25376f69f305e9527ee2 Mon Sep 17 00:00:00 2001 From: Shuhei Kitagawa Date: Sun, 28 Jan 2018 16:17:37 +0900 Subject: Add a test for ActiveStorage::Blob#image? and ActiveStorage::Blob#video? --- activestorage/test/models/blob_test.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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? -- cgit v1.2.3