2
0

Fix SMTP configuration with mail 2.9.0 (#36646)

This commit is contained in:
Claire
2025-10-30 12:21:32 +01:00
parent 2a9c7d2b9e
commit e4291e9b05
3 changed files with 38 additions and 23 deletions

View File

@@ -21,8 +21,9 @@ RSpec.describe Mastodon::EmailConfigurationHelper do
base_configuration.merge({ enable_starttls: 'always' })
end
it 'converts this to `true`' do
expect(converted_settings[:enable_starttls]).to be true
it 'converts this to `:always`' do
expect(converted_settings[:enable_starttls]).to eq :always
expect(converted_settings[:enable_starttls_auto]).to be_nil
end
end
@@ -33,6 +34,7 @@ RSpec.describe Mastodon::EmailConfigurationHelper do
it 'converts this to `false`' do
expect(converted_settings[:enable_starttls]).to be false
expect(converted_settings[:enable_starttls_auto]).to be_nil
end
end
@@ -41,28 +43,43 @@ RSpec.describe Mastodon::EmailConfigurationHelper do
base_configuration.merge({ enable_starttls: 'auto' })
end
it 'sets `enable_starttls_auto` instead' do
expect(converted_settings[:enable_starttls]).to be_nil
expect(converted_settings[:enable_starttls_auto]).to be true
it 'sets `enable_starttls` to `:auto`' do
expect(converted_settings[:enable_starttls]).to eq :auto
expect(converted_settings[:enable_starttls_auto]).to be_nil
end
end
context 'when `enable_starttls` is unset' do
context 'when `enable_starttls_auto` is unset' do
let(:configuration) { base_configuration }
context 'when `enable_starttls_auto` is true' do
let(:configuration) do
base_configuration.merge({ enable_starttls_auto: true })
end
it 'sets `enable_starttls_auto` to `true`' do
expect(converted_settings[:enable_starttls_auto]).to be true
it 'sets `enable_starttls` to `:auto`' do
expect(converted_settings[:enable_starttls]).to eq :auto
expect(converted_settings[:enable_starttls_auto]).to be_nil
end
end
context 'when `enable_starttls_auto` is set to "false"' do
context 'when `tls` is set to true' do
let(:configuration) do
base_configuration.merge({ enable_starttls_auto: 'false' })
base_configuration.merge({ tls: true })
end
it 'sets `enable_starttls_auto` to `false`' do
expect(converted_settings[:enable_starttls_auto]).to be false
it 'sets `enable_starttls` to `nil`' do
expect(converted_settings[:enable_starttls]).to be_nil
expect(converted_settings[:enable_starttls_auto]).to be_nil
end
end
context 'when `enable_starttls_auto` is set to false' do
let(:configuration) do
base_configuration.merge({ enable_starttls_auto: false })
end
it 'sets `enable_starttls` to `false`' do
expect(converted_settings[:enable_starttls]).to be false
expect(converted_settings[:enable_starttls_auto]).to be_nil
end
end
end

View File

@@ -27,6 +27,7 @@ RSpec.describe UserMailer do
address: 'localhost',
port: 25,
authentication: 'none',
enable_starttls_auto: true,
}
end
@@ -44,8 +45,7 @@ RSpec.describe UserMailer do
address: 'localhost',
port: 25,
authentication: nil,
enable_starttls: nil,
enable_starttls_auto: true,
enable_starttls: :auto,
})
end
end