mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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.
This commit is contained in:
parent
fa82ea4098
commit
3eb48a2148
1 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue