Immediate avatar and embed variants (#2002)

Reverts #2001
Restores #1955
This commit is contained in:
Jorge Manrubia
2025-12-08 23:17:06 +01:00
committed by GitHub
parent f8a812f038
commit cb0e9b9962
10 changed files with 62 additions and 19 deletions
@@ -27,7 +27,9 @@ class Users::AvatarsControllerTest < ActionDispatch::IntegrationTest
end
test "show own image redirects to the blob url" do
users(:david).avatar.attach(io: File.open(file_fixture("moon.jpg")), filename: "moon.jpg", content_type: "image/jpeg")
# Create blob separately to ensure file is uploaded before variant processing
blob = ActiveStorage::Blob.create_and_upload!(io: File.open(file_fixture("moon.jpg")), filename: "moon.jpg", content_type: "image/jpeg")
users(:david).avatar.attach(blob)
assert users(:david).avatar.attached?
get user_avatar_path(users(:david))
@@ -36,7 +38,9 @@ class Users::AvatarsControllerTest < ActionDispatch::IntegrationTest
end
test "show other image redirects to the blob url" do
users(:kevin).avatar.attach(io: File.open(file_fixture("moon.jpg")), filename: "moon.jpg", content_type: "image/jpeg")
# Create blob separately to ensure file is uploaded before variant processing
blob = ActiveStorage::Blob.create_and_upload!(io: File.open(file_fixture("moon.jpg")), filename: "moon.jpg", content_type: "image/jpeg")
users(:kevin).avatar.attach(blob)
assert users(:kevin).avatar.attached?
get user_avatar_path(users(:kevin))