mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #36045 from yfxie/fix-normalize-the-hash-of-transformations
ActiveStorage - normalize the hash of transformations
This commit is contained in:
commit
a89e9cccb2
2 changed files with 9 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue