Skip to content

Commit

Permalink
Merge pull request #31810 from shuheiktgw/add_tests_for_blob
Browse files Browse the repository at this point in the history
Added tests for ActiveStorage::Blob#image? and ActiveStorage::Blob#video?
  • Loading branch information
georgeclaghorn committed Jan 29, 2018
2 parents 159b21b + 530a797 commit e57e0a9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions activestorage/test/models/blob_test.rb
Expand Up @@ -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?
Expand Down

0 comments on commit e57e0a9

Please sign in to comment.