diff options
author | Simo Leone <leone.simo@gmail.com> | 2019-01-24 16:56:24 +0000 |
---|---|---|
committer | Simo Leone <leone.simo@gmail.com> | 2019-01-24 17:05:49 +0000 |
commit | c5b71c9baea4959c096774c763e558df2979a9db (patch) | |
tree | 55fd34d33725056dc2c3dc3b9e5fb8ed7c5a936a /activestorage/test | |
parent | 1fecebae31029cf2287f2bae88e8730f00569778 (diff) | |
download | rails-c5b71c9baea4959c096774c763e558df2979a9db.tar.gz rails-c5b71c9baea4959c096774c763e558df2979a9db.tar.bz2 rails-c5b71c9baea4959c096774c763e558df2979a9db.zip |
include the content type when uploading to S3
Diffstat (limited to 'activestorage/test')
-rw-r--r-- | activestorage/test/service/s3_service_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/activestorage/test/service/s3_service_test.rb b/activestorage/test/service/s3_service_test.rb index 0a6004267f..74c0aa0405 100644 --- a/activestorage/test/service/s3_service_test.rb +++ b/activestorage/test/service/s3_service_test.rb @@ -59,6 +59,24 @@ if SERVICE_CONFIGURATIONS[:s3] service.delete key end end + + test "upload with content type" do + key = SecureRandom.base58(24) + data = "Something else entirely!" + content_type = "text/plain" + + @service.upload( + key, + StringIO.new(data), + checksum: Digest::MD5.base64digest(data), + filename: "cool_data.txt", + content_type: content_type + ) + + assert_equal content_type, @service.bucket.object(key).content_type + ensure + @service.delete key + end end else puts "Skipping S3 Service tests because no S3 configuration was supplied" |