diff options
author | George Claghorn <george.claghorn@gmail.com> | 2018-05-08 18:46:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-08 18:46:08 -0400 |
commit | 38ea7bb74d5c3d2ae992c35b6eb731d059aa772a (patch) | |
tree | 8be2f5c25a30ea0f1ad42a8ce74992ac5aa2cdab /activestorage/test/models/blob_test.rb | |
parent | 834be61e61a1ed55f056cdff12ffe4cdcaa7ca65 (diff) | |
parent | 8e98bb7758f081622ab5c4eebf3730cce22ee627 (diff) | |
download | rails-38ea7bb74d5c3d2ae992c35b6eb731d059aa772a.tar.gz rails-38ea7bb74d5c3d2ae992c35b6eb731d059aa772a.tar.bz2 rails-38ea7bb74d5c3d2ae992c35b6eb731d059aa772a.zip |
Merge pull request #32833 from ryandav/activestorage_blob_set_content_type
Add option to ActiveStorage::Blob to set extract_content_type_from_io
Diffstat (limited to 'activestorage/test/models/blob_test.rb')
-rw-r--r-- | activestorage/test/models/blob_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activestorage/test/models/blob_test.rb b/activestorage/test/models/blob_test.rb index daa01015f7..17151117db 100644 --- a/activestorage/test/models/blob_test.rb +++ b/activestorage/test/models/blob_test.rb @@ -43,6 +43,16 @@ class ActiveStorage::BlobTest < ActiveSupport::TestCase assert_equal "text/plain", blob.content_type end + test "create after upload extracts content_type from io when no content_type given and identify: false" do + blob = create_blob content_type: nil, identify: false + assert_equal "text/plain", blob.content_type + end + + test "create after upload uses content_type when identify: false" do + blob = create_blob data: "Article,dates,analysis\n1, 2, 3", filename: "table.csv", content_type: "text/csv", identify: false + assert_equal "text/csv", blob.content_type + end + test "image?" do blob = create_file_blob filename: "racecar.jpg" assert_predicate blob, :image? |