I\'ve got a mailer sending through a GMail account, and I want to test that ActionMailer can actually log in to GMail\'s SMTP server with the credentials I\'ve given it. What\'s
smtp = Net::SMTP.new settings[:address], settings[:port]
smtp.enable_starttls_auto if settings[:enable_starttls_auto]
smtp.start(settings[:domain]) do
expect {
smtp.authenticate settings[:user_name], settings[:password], settings[:authentication]
}.to_not raise_error
end
Calling authenticate
will raise a Net::SMTPAuthenticationError
if the authentication fails.
Otherwise, it will return a Net::SMTP::Response
, and calling status
on the response will return "235"
.