提交 3eb48a21 编写于 作者: V Victor Perez Rodriguez

fix misleading variant test

This commit fixes the "resized variation of BMP blob" test.

By default `create_file_blob` use "image/jpeg" as content type,
since this test does not specify the correct `content_type` for
a `*.bmp` image ("image/bmp") the `ActiveStorage::Variant#specification`
consider the blob as a web image which causes the variant to return a
`*.bmp` URL and a "BMP" type, this is an incorrect behavior since if you
upload a `*.bmp` image the variant will have a PNG format with "image/png"
as content type.

After this change the test will cover the current activestorage behavior.

Changes:

* Specify correct `content_type` on "resized variation of BMP blob" test.
* Change asserts to cover the current activestorage behavior.
上级 fa82ea40
......@@ -162,12 +162,12 @@ class ActiveStorage::VariantTest < ActiveSupport::TestCase
end
test "resized variation of BMP blob" do
blob = create_file_blob(filename: "colors.bmp")
blob = create_file_blob(filename: "colors.bmp", content_type: "image/bmp")
variant = blob.variant(resize: "15x15").processed
assert_match(/colors\.bmp/, variant.url)
assert_match(/colors\.png/, variant.url)
image = read_image(variant)
assert_equal "BMP", image.type
assert_equal "PNG", image.type
assert_equal 15, image.width
assert_equal 8, image.height
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册