aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/test
diff options
context:
space:
mode:
authorGeorge Claghorn <george.claghorn@gmail.com>2018-02-24 15:27:53 -0500
committerGeorge Claghorn <george.claghorn@gmail.com>2018-02-24 15:27:57 -0500
commit3915a470d2b8898fdbc384d0f9f31e2ad8a2c899 (patch)
treefee562827a93af6ebec14543f6106c1fc1248e5b /activestorage/test
parentd04b5179ffc26ab7bfd7210e1103f5ab4f1bd54f (diff)
downloadrails-3915a470d2b8898fdbc384d0f9f31e2ad8a2c899.tar.gz
rails-3915a470d2b8898fdbc384d0f9f31e2ad8a2c899.tar.bz2
rails-3915a470d2b8898fdbc384d0f9f31e2ad8a2c899.zip
Support varying ICO files
Closes #32096.
Diffstat (limited to 'activestorage/test')
-rw-r--r--activestorage/test/fixtures/files/favicon.icobin0 -> 16958 bytes
-rw-r--r--activestorage/test/models/variant_test.rb11
2 files changed, 11 insertions, 0 deletions
diff --git a/activestorage/test/fixtures/files/favicon.ico b/activestorage/test/fixtures/files/favicon.ico
new file mode 100644
index 0000000000..87192a8a07
--- /dev/null
+++ b/activestorage/test/fixtures/files/favicon.ico
Binary files 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")