diff options
Diffstat (limited to 'activestorage/test/service/mirror_service_test.rb')
-rw-r--r-- | activestorage/test/service/mirror_service_test.rb | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/activestorage/test/service/mirror_service_test.rb b/activestorage/test/service/mirror_service_test.rb index bb502dde60..249a5652fb 100644 --- a/activestorage/test/service/mirror_service_test.rb +++ b/activestorage/test/service/mirror_service_test.rb @@ -18,22 +18,20 @@ class ActiveStorage::Service::MirrorServiceTest < ActiveSupport::TestCase include ActiveStorage::Service::SharedServiceTests test "uploading to all services" do - begin - key = SecureRandom.base58(24) - data = "Something else entirely!" - io = StringIO.new(data) - checksum = Digest::MD5.base64digest(data) - - @service.upload key, io.tap(&:read), checksum: checksum - assert_predicate io, :eof? - - assert_equal data, @service.primary.download(key) - @service.mirrors.each do |mirror| - assert_equal data, mirror.download(key) - end - ensure - @service.delete key + key = SecureRandom.base58(24) + data = "Something else entirely!" + io = StringIO.new(data) + checksum = Digest::MD5.base64digest(data) + + @service.upload key, io.tap(&:read), checksum: checksum + assert_predicate io, :eof? + + assert_equal data, @service.primary.download(key) + @service.mirrors.each do |mirror| + assert_equal data, mirror.download(key) end + ensure + @service.delete key end test "downloading from primary service" do @@ -63,4 +61,8 @@ class ActiveStorage::Service::MirrorServiceTest < ActiveSupport::TestCase @service.url(@key, expires_in: 2.minutes, disposition: :inline, filename: filename, content_type: "text/plain") end end + + test "path for file in primary service" do + assert_equal @service.primary.path_for(@key), @service.path_for(@key) + end end |