Merge pull request #36045 from yfxie/fix-normalize-the-hash-of-transformations

ActiveStorage - normalize the hash of transformations
This commit is contained in:
George Claghorn 2019-04-21 16:07:54 -04:00 committed by GitHub
commit a89e9cccb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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