class ActiveStorage::Service::DiskServiceReadTest

Overview

The read side of the same service. The content is written to the sharded path directly, so a read is not asserted through the write that set it up. :nodoc:

Defined in:

active_storage/service/disk_service_test.cr

Constant Summary

CONTENT = "0123456789abcdef"
KEY = "gz0zdzhk0yn6zjhxfzl6qt1ys5rj"

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_yields_chunks_the_caller_may_keep #

The slices are kept instead of being copied with String.new, which is what catches a buffer reused across reads: the second read used to overwrite the head of the first chunk, so the chunks a caller held no longer joined back into the content.