2

我遇到了一个问题,即在第一次调用ActionMailer::Base#mail方法时运行邮件程序的第一次测试时,测试挂起并需要大约 10 分钟。有没有人经历过这个?

CircleCi 图像:图像:circleci/ruby:2.4.3-node

我的测试

class Notifier::AccountMailer < NotifierMailer
  def welcome(user_id)
    @user = User.find user_id

    mail(to: @user.email, subject: t('subject.welcome'))
  end
end

RSpec.describe Notifier::AccountMailer, type: :mailer do
 describe '.welcome' do
   let(:user) { build_stubbed(:user) }
   let(:mail) { described_class.welcome(1) }
   before { allow(User).to receive(:find).and_return(user) }

   it 'Send from <notify@my-server.me>' do
     expect(mail.from).to eq(['notify@my-server.me'])
   end

   it 'Send to account e-mail' do
     expect(mail.to).to eq([user.email])
   end
 end
end

缓慢仅发生在邮件方法的第一次调用中,一切正常之后。

4

0 回答 0