Lea*_*nes 5 email testing rspec ruby-on-rails circleci-2.0
我遇到一个问题,当运行邮件程序的第一次测试时,当第一次调用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
Run Code Online (Sandbox Code Playgroud)
缓慢仅发生在一切正常后第一次调用邮件方法时。
归档时间: |
|
查看次数: |
341 次 |
最近记录: |