2022-06-07 22:58:04 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-07-28 10:27:38 +08:00
|
|
|
RSpec.describe FreedomPatches::MailDisableStarttls do
|
2022-06-07 22:58:04 +08:00
|
|
|
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
|
2022-07-28 10:27:38 +08:00
|
|
|
expect(smtp_session.starttls?).to eq(:auto)
|
2022-06-07 22:58:04 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "when the starttls option is set to `false`" do
|
|
|
|
let(:options) { { enable_starttls_auto: false } }
|
|
|
|
|
|
|
|
it "properly disables starttls" do
|
2022-07-28 10:27:38 +08:00
|
|
|
expect(smtp_session.starttls?).to eq(false)
|
2022-06-07 22:58:04 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|