normalize the hash of transformations
This commit is contained in:
parent
96cf7e0e67
commit
6be1446fc7
|
@ -40,7 +40,7 @@ class ActiveStorage::Variation
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(transformations)
|
def initialize(transformations)
|
||||||
@transformations = transformations
|
@transformations = transformations.deep_symbolize_keys
|
||||||
end
|
end
|
||||||
|
|
||||||
# Accepts a File object, performs the +transformations+ against it, and
|
# Accepts a File object, performs the +transformations+ against it, and
|
||||||
|
|
|
@ -4,6 +4,14 @@ require "test_helper"
|
||||||
require "database/setup"
|
require "database/setup"
|
||||||
|
|
||||||
class ActiveStorage::VariantTest < ActiveSupport::TestCase
|
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
|
test "resized variation of JPEG blob" do
|
||||||
blob = create_file_blob(filename: "racecar.jpg")
|
blob = create_file_blob(filename: "racecar.jpg")
|
||||||
variant = blob.variant(resize: "100x100").processed
|
variant = blob.variant(resize: "100x100").processed
|
||||||
|
|
Loading…
Reference in New Issue