From 3915a470d2b8898fdbc384d0f9f31e2ad8a2c899 Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Sat, 24 Feb 2018 15:27:53 -0500 Subject: Support varying ICO files Closes #32096. --- activestorage/test/fixtures/files/favicon.ico | Bin 0 -> 16958 bytes activestorage/test/models/variant_test.rb | 11 +++++++++++ 2 files changed, 11 insertions(+) create mode 100644 activestorage/test/fixtures/files/favicon.ico (limited to 'activestorage/test') diff --git a/activestorage/test/fixtures/files/favicon.ico b/activestorage/test/fixtures/files/favicon.ico new file mode 100644 index 0000000000..87192a8a07 Binary files /dev/null and b/activestorage/test/fixtures/files/favicon.ico differ diff --git a/activestorage/test/models/variant_test.rb b/activestorage/test/models/variant_test.rb index 0cf8a583bd..0f3ada25c0 100644 --- a/activestorage/test/models/variant_test.rb +++ b/activestorage/test/models/variant_test.rb @@ -50,6 +50,17 @@ class ActiveStorage::VariantTest < ActiveSupport::TestCase assert_equal 20, image.height end + test "resized variation of ICO blob" do + blob = create_file_blob(filename: "favicon.ico", content_type: "image/vnd.microsoft.icon") + variant = blob.variant(resize: "20x20").processed + assert_match(/icon\.png/, variant.service_url) + + image = read_image(variant) + assert_equal "PNG", image.type + assert_equal 20, image.width + assert_equal 20, image.height + end + test "optimized variation of GIF blob" do blob = create_file_blob(filename: "image.gif", content_type: "image/gif") -- cgit v1.2.3