aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/test
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2018-09-11 17:56:29 -0400
committerGitHub <noreply@github.com>2018-09-11 17:56:29 -0400
commite9ae7a1514d660fee8cacc6a9aa7524f6f4617e3 (patch)
tree3cd40e9cb322693bbcf09fcfc575d18ef427fb92 /activestorage/test
parentab0eed599b9cb2b62eab79ae761464ea732b2e70 (diff)
parent0d4ba40688785ad65da1af36b3ad8efd8e14505e (diff)
downloadrails-e9ae7a1514d660fee8cacc6a9aa7524f6f4617e3.tar.gz
rails-e9ae7a1514d660fee8cacc6a9aa7524f6f4617e3.tar.bz2
rails-e9ae7a1514d660fee8cacc6a9aa7524f6f4617e3.zip
Merge pull request #33795 from marceloperini/marceloperini/33450-active-storage
Fix zero-byte files upload in #33630
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")