aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/test
diff options
context:
space:
mode:
authorMarcelo Perini Veloso <marcelo.perini.veloso@gmail.com>2018-09-05 00:21:44 -0300
committerMarcelo Perini Veloso <marcelo.perini.veloso@gmail.com>2018-09-06 20:04:21 -0300
commit0d4ba40688785ad65da1af36b3ad8efd8e14505e (patch)
tree01cad8807fa1c5534fe0b0f4297c182cdd9d2535 /activestorage/test
parent5bd4a4c78b43f25245d3597876f541d84782ecc7 (diff)
downloadrails-0d4ba40688785ad65da1af36b3ad8efd8e14505e.tar.gz
rails-0d4ba40688785ad65da1af36b3ad8efd8e14505e.tar.bz2
rails-0d4ba40688785ad65da1af36b3ad8efd8e14505e.zip
Fix zero-byte files upload
Diffstat (limited to 'activestorage/test')
-rw-r--r--activestorage/test/fixtures/files/empty_file.txt0
-rw-r--r--activestorage/test/service/s3_service_test.rb7
2 files changed, 7 insertions, 0 deletions
diff --git a/activestorage/test/fixtures/files/empty_file.txt b/activestorage/test/fixtures/files/empty_file.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/activestorage/test/fixtures/files/empty_file.txt
diff --git a/activestorage/test/service/s3_service_test.rb b/activestorage/test/service/s3_service_test.rb
index 4bfcda017f..559aa028f2 100644
--- a/activestorage/test/service/s3_service_test.rb
+++ b/activestorage/test/service/s3_service_test.rb
@@ -31,6 +31,13 @@ if SERVICE_CONFIGURATIONS[:s3]
end
end
+ test "upload a zero byte file" do
+ blob = directly_upload_file_blob filename: "empty_file.txt", content_type: nil
+ user = User.create! name: "DHH", avatar: blob
+
+ assert_equal user.avatar.blob, blob
+ end
+
test "signed URL generation" do
url = @service.url(@key, expires_in: 5.minutes,
disposition: :inline, filename: ActiveStorage::Filename.new("avatar.png"), content_type: "image/png")