mirror of
https://github.com/discourse/discourse.git
synced 2024-12-11 22:15:47 +08:00
69af29cc40
Why this change?
This is a follow up to 897be75941
.
When updating `net-smtp` from `0.4.x` to `0.5.x`, our test suite passed
but the error `ArgumentError: SMTP-AUTH requested but missing user name`
was being thrown in production leading to emails being failed to send
out via SMTP.
This commit adds a test to ensure that our production SMTP settings will
at least attemp to connect to an SMTP server.
29 lines
890 B
Ruby
29 lines
890 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe "SMTP Settings Integration" do
|
|
before do
|
|
@original_action_mailer_smtp_settings = ActionMailer::Base.smtp_settings
|
|
@original_action_mailer_delivery_method = ActionMailer::Base.delivery_method
|
|
ActionMailer::Base.delivery_method = :smtp
|
|
end
|
|
|
|
after do
|
|
ActionMailer::Base.smtp_settings = @original_action_mailer_smtp_settings
|
|
ActionMailer::Base.delivery_method = @original_action_mailer_delivery_method
|
|
end
|
|
|
|
it "should send out the email successfully using the SMTP settings" do
|
|
global_setting :smtp_address, "some.host"
|
|
global_setting :smtp_port, 12_345
|
|
|
|
ActionMailer::Base.smtp_settings = GlobalSetting.smtp_settings
|
|
|
|
message = TestMailer.send_test("some_email")
|
|
|
|
expect do Email::Sender.new(message, :test_message).send end.to raise_error(
|
|
StandardError,
|
|
/some.host/,
|
|
)
|
|
end
|
|
end
|