diff options
author | George Claghorn <george@basecamp.com> | 2018-08-03 22:41:19 -0400 |
---|---|---|
committer | George Claghorn <george@basecamp.com> | 2018-08-03 22:41:19 -0400 |
commit | bd680dd59a6274cf566930241783d83ce44c879d (patch) | |
tree | 87278c74ae3750b5fd908f0a703a42a3bf3da279 /activestorage/test/service | |
parent | a69394e9fd7ef826bdd35f10f054405ecd6760cf (diff) | |
download | rails-bd680dd59a6274cf566930241783d83ce44c879d.tar.gz rails-bd680dd59a6274cf566930241783d83ce44c879d.tar.bz2 rails-bd680dd59a6274cf566930241783d83ce44c879d.zip |
Fix uploading Tempfiles to Azure Storage
Closes #32530.
Diffstat (limited to 'activestorage/test/service')
-rw-r--r-- | activestorage/test/service/azure_storage_service_test.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/activestorage/test/service/azure_storage_service_test.rb b/activestorage/test/service/azure_storage_service_test.rb index 76920850d1..09c2e7f99c 100644 --- a/activestorage/test/service/azure_storage_service_test.rb +++ b/activestorage/test/service/azure_storage_service_test.rb @@ -16,6 +16,23 @@ if SERVICE_CONFIGURATIONS[:azure] assert_match(/(\S+)&rscd=inline%3B\+filename%3D%22avatar\.png%22%3B\+filename\*%3DUTF-8%27%27avatar\.png&rsct=image%2Fpng/, url) assert_match SERVICE_CONFIGURATIONS[:azure][:container], url end + + test "uploading a tempfile" do + begin + key = SecureRandom.base58(24) + data = "Something else entirely!" + + Tempfile.open do |file| + file.write(data) + file.rewind + @service.upload(key, file) + end + + assert_equal data, @service.download(key) + ensure + @service.delete(key) + end + end end else puts "Skipping Azure Storage Service tests because no Azure configuration was supplied" |