class ActiveStorage::Service::S3ServiceReadTest

Overview

The read side of the same service. The content is stored with the Awscr::S3 client rather than with #upload, so a read is not asserted through the write that set it up. :nodoc:

Defined in:

active_storage/service/s3_service_test.cr

Constant Summary

ACCESS_KEY_ID = "admin"
BUCKET = "storage"
CONTENT = "0123456789abcdef"
ENDPOINT = ENV.fetch("S3_ENDPOINT", "http://127.0.0.1:9000")
REGION = "us-east-1"
SECRET_ACCESS_KEY = "password"

Instance Method Summary

Instance Method Detail

def setup #

def teardown #

def test_download_chunk_raises_when_nothing_is_stored_for_the_key #

def test_download_chunk_returns_a_range_ending_at_the_last_byte #

def test_download_chunk_returns_the_inclusive_byte_range #

def test_download_raises_when_nothing_is_stored_for_the_key #

def test_download_returns_the_whole_content #

def test_download_yields_the_content_in_chunks #

The content crosses the chunk boundary, so the block form issues more than one ranged read. The bytes differ on either side of the boundary, so a repeated or reordered chunk does not pass.


def test_exist_is_false_after_a_delete #

def test_exist_is_false_for_a_key_nothing_was_stored_under #

def test_exist_is_true_only_once_the_object_is_stored #

def test_storing_a_key_again_replaces_the_object #

A shorter content replacing a longer one: the whole object goes, so no byte of the old one is left past the end of the new.