discourse/spec/services/problem_check/starttls_disabled_spec.rb
Michael Brown 2354eb3419 FIX: actually disable SMTP starttls if the user is attempting to disable it
starttls is implicitly enabled by default, we need to explicitly disable it if
the user wants to do so

Without doing so, the SMTP module would still attempt starttls if offered, but
potentially with the wrong context.

This has the potential side effect of leaving people with a non-working email
configuration if they previously attempted to disable starttls but actually
require it, so add a problem check to ensure that the admin is notified.
2025-11-04 23:42:14 -05:00

21 lines
617 B
Ruby
Vendored

# frozen_string_literal: true
RSpec.describe ProblemCheck::StarttlsDisabled do
subject(:check) { described_class.new }
describe ".call" do
context "with STARTTLS enabled" do
before { GlobalSetting.stubs(:smtp_enable_start_tls).returns(true) }
it { expect(check).to be_chill_about_it }
end
context "with STARTTLS disabled" do
before { GlobalSetting.stubs(:smtp_enable_start_tls).returns(false) }
it do
expect(check).to have_a_problem.with_priority("high").with_message(
I18n.t("dashboard.problem.#{check.identifier}"),
)
end
end
end
end