class ActiveStorage::VariantProcessedTest

Overview

The write path: a variation nothing has stored is transformed and uploaded under Variant#key, which is the layout a Rails app with config.active_storage.track_variants off writes.

The Disk service is used rather than the presigning S3 one above, because these cases read back what was actually stored. No row is written in this layout, so no database is needed either. :nodoc:

Defined in:

active_storage/variant_test.cr

Constant Summary

AVATAR_PATH = (Path["/woodpecker/src/codeberg.org/miry/marten-rails-bridge/src/active_storage"].join("../../examples/demo/src/assets/images/avatar.jpg")).normalize.to_s

The 1600x1200 image the demo serves, committed next to it.

BLOB_KEY = "gz0zdzhk0yn6zjhxfzl6qt1ys5rj"

Instance Method Summary

Instance Method Detail

def setup #

def teardown #

def test_processed_does_not_process_again #

def test_processed_does_not_process_what_another_request_stored #

A second ActiveStorage::Variant for the same variation finds the object of the first one.


def test_processed_encodes_the_variation_format #

The source is a JPEG, so a png variation proves the saver the variation names is the one that ran, rather than the source format being passed through.


def test_processed_is_false_until_the_image_is_stored #

def test_processed_raises_for_an_operation_the_processor_does_not_implement #

def test_processed_raises_when_the_source_is_not_stored #

def test_processed_raises_without_a_processor_backend #

An app that never assigned a backend. The variation is fine, the deployment is not configured, so this is not a missing representation.


def test_processed_resizes_the_source #

The dimensions come from the bytes that were stored, not from the variation that asked for them.


def test_processed_returns_itself #

def test_processed_stores_the_image_under_the_derived_key #