class ActiveStorage::BlobCreateAndUploadTest

Overview

.create_and_upload! writes a row and an object, hence a separate test case: it runs against the Disk service, which needs no object storage. :nodoc:

Defined in:

active_storage/blob_test.cr

Constant Summary

CONTENT = "0123456789abcdef"

Instance Method Summary

Instance Method Detail

def setup #

def teardown #

def test_create_and_upload_accepts_a_file #

The IO an app hands over is the tempfile of an uploaded part, not an IO::Memory.


def test_create_and_upload_accepts_an_explicit_key #

def test_create_and_upload_deletes_the_row_when_the_upload_fails #

def test_create_and_upload_generates_a_base36_key #

def test_create_and_upload_persists_the_row #

def test_create_and_upload_rejects_an_io_it_cannot_rewind #

An IO the checksum pass cannot rewind is refused, the way Rails refuses one, and the refusal comes before the row so there is nothing to delete.


def test_create_and_upload_serves_a_binary_type_as_an_attachment #

def test_create_and_upload_serves_an_inline_allowed_type_without_a_forced_disposition #

def test_create_and_upload_stores_the_content_in_the_service #

def test_create_and_upload_unfurls_a_content_larger_than_one_read #

The checksum pass reads the IO a chunk at a time, so a content spanning several reads proves the chunks are fed to the digest in order and none is counted twice.


def test_create_and_upload_unfurls_the_content #

def test_generate_unique_secure_token_honours_the_passed_length #