Merge commit '13ab4b54e2' into upstream-20241204-15

This commit is contained in:
KMY 2024-12-04 08:37:37 +09:00
commit a6a237bc8e
228 changed files with 2678 additions and 1266 deletions

View file

@ -0,0 +1,44 @@
# frozen_string_literal: true
module DomainHelpers
def configure_mx(domain:, exchange:, ip_v4_addr: '2.3.4.5', ip_v6_addr: 'fd00::2')
resolver = instance_double(Resolv::DNS, :timeouts= => nil)
allow(resolver).to receive(:getresources)
.with(domain, Resolv::DNS::Resource::IN::MX)
.and_return([double_mx(exchange)])
allow(resolver)
.to receive(:getresources)
.with(domain, Resolv::DNS::Resource::IN::A)
.and_return([])
allow(resolver)
.to receive(:getresources)
.with(domain, Resolv::DNS::Resource::IN::AAAA)
.and_return([])
allow(resolver)
.to receive(:getresources)
.with(exchange, Resolv::DNS::Resource::IN::A)
.and_return([double_resource_v4(ip_v4_addr)])
allow(resolver)
.to receive(:getresources)
.with(exchange, Resolv::DNS::Resource::IN::AAAA)
.and_return([double_resource_v6(ip_v6_addr)])
allow(Resolv::DNS)
.to receive(:open)
.and_yield(resolver)
end
private
def double_mx(exchange)
instance_double(Resolv::DNS::Resource::MX, exchange: exchange)
end
def double_resource_v4(addr)
instance_double(Resolv::DNS::Resource::IN::A, address: addr)
end
def double_resource_v6(addr)
instance_double(Resolv::DNS::Resource::IN::AAAA, address: addr)
end
end

View file

@ -2,13 +2,20 @@
RSpec.shared_examples 'AccountAvatar' do |fabricator|
describe 'static avatars', :attachment_processing do
describe 'when GIF' do
describe 'with a square GIF' do
it 'creates a png static style' do
account = Fabricate(fabricator, avatar: attachment_fixture('avatar.gif'))
expect(account.avatar_static_url).to_not eq account.avatar_original_url
end
end
describe 'with a higher-than-wide GIF' do
it 'creates a png static style' do
account = Fabricate(fabricator, avatar: attachment_fixture('avatar-high.gif'))
expect(account.avatar_static_url).to_not eq account.avatar_original_url
end
end
describe 'when non-GIF' do
it 'does not create extra static style' do
account = Fabricate(fabricator, avatar: attachment_fixture('attachment.jpg'))