diff options
author | George Claghorn <george.claghorn@gmail.com> | 2018-05-01 23:20:56 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-01 23:20:56 -0400 |
commit | bf5f41d948b6f3f27db7fdc2b70897aec991065f (patch) | |
tree | eb3fcfe108b84147331e1ee58f384e41318084d1 /activestorage/test | |
parent | db7416cda0700876ad3438774b804eb80a05a758 (diff) | |
download | rails-bf5f41d948b6f3f27db7fdc2b70897aec991065f.tar.gz rails-bf5f41d948b6f3f27db7fdc2b70897aec991065f.tar.bz2 rails-bf5f41d948b6f3f27db7fdc2b70897aec991065f.zip |
Support streaming downloads from Google Cloud Storage
Diffstat (limited to 'activestorage/test')
-rw-r--r-- | activestorage/test/service/shared_service_tests.rb | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/activestorage/test/service/shared_service_tests.rb b/activestorage/test/service/shared_service_tests.rb index 24debe7f47..b9f352e460 100644 --- a/activestorage/test/service/shared_service_tests.rb +++ b/activestorage/test/service/shared_service_tests.rb @@ -51,13 +51,21 @@ module ActiveStorage::Service::SharedServiceTests end test "downloading in chunks" do - chunks = [] + key = SecureRandom.base58(24) + expected_chunks = [ "a" * 5.megabytes, "b" ] + actual_chunks = [] - @service.download(FIXTURE_KEY) do |chunk| - chunks << chunk - end + begin + @service.upload key, StringIO.new(expected_chunks.join) + + @service.download key do |chunk| + actual_chunks << chunk + end - assert_equal [ FIXTURE_DATA ], chunks + assert_equal expected_chunks, actual_chunks, "Downloaded chunks did not match uploaded data" + ensure + @service.delete key + end end test "downloading partially" do |