normalize the hash of transformations

This commit is contained in:
Yi Feng 2019-04-20 18:05:58 +08:00
parent 96cf7e0e67
commit 6be1446fc7
2 changed files with 9 additions and 1 deletions

View File

@ -40,7 +40,7 @@ class ActiveStorage::Variation
end
def initialize(transformations)
@transformations = transformations
@transformations = transformations.deep_symbolize_keys
end
# Accepts a File object, performs the +transformations+ against it, and

View File

@ -4,6 +4,14 @@ require "test_helper"
require "database/setup"
class ActiveStorage::VariantTest < ActiveSupport::TestCase
test "variations have the same key for different types of the same transformation" do
blob = create_file_blob(filename: "racecar.jpg")
variant_a = blob.variant(resize: "100x100")
variant_b = blob.variant("resize" => "100x100")
assert_equal variant_a.key, variant_b.key
end
test "resized variation of JPEG blob" do
blob = create_file_blob(filename: "racecar.jpg")
variant = blob.variant(resize: "100x100").processed