mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 20:24:05 -06:00
fff3ff11c0
Following the Rails 7 upgrade, the `DISCOURSE_SMTP_ENABLE_START_TLS` setting doesn’t work anymore. This is because Rails upgraded the `net-smtp` gem to the 0.3.1 version which enables `starttls` by default. The `mail` gem doesn’t support this new behavior yet and doesn’t know how to disable TLS. This should be fixed in an upcoming release. Meanwhile applying this patch allows us to get back the previous behavior which is expected by many.
24 lines
567 B
Ruby
24 lines
567 B
Ruby
# frozen_string_literal: true
|
|
|
|
describe FreedomPatches::MailDisableStarttls do
|
|
subject(:smtp_session) { smtp.build_smtp_session }
|
|
|
|
let(:smtp) { Mail::SMTP.new(options) }
|
|
|
|
context "when the starttls option is not provided" do
|
|
let(:options) { {} }
|
|
|
|
it "doesn't disable starttls" do
|
|
expect(smtp_session).to be_starttls
|
|
end
|
|
end
|
|
|
|
context "when the starttls option is set to `false`" do
|
|
let(:options) { { enable_starttls_auto: false } }
|
|
|
|
it "properly disables starttls" do
|
|
expect(smtp_session).not_to be_starttls
|
|
end
|
|
end
|
|
end
|