gpt4 book ai didi

ruby-on-rails - cucumber + EmailSpec + Rails3:为什么说在实际工作时没有发送电子邮件?

转载 作者:行者123 更新时间:2023-12-02 04:12:45 24 4
gpt4 key购买 nike

我正在使用EmailSpec使用Cucumber测试电子邮件。我的测试失败,并说没有发送电子邮件,但是我找不到我的代码有什么问题,因此我在生产中进行了尝试,并且电子邮件已发送

这是失败的步骤:

# ...
And I should see "You have requested for a condition report, and will be emailed one as soon as we are able to process your request." # features/step_definitions/web_steps.rb:107
And I should receive an email # features/step_definitions/email_steps.rb:51
expected: 1,
got: 0 (using ==) (RSpec::Expectations::ExpectationNotMetError)
./features/step_definitions/email_steps.rb:52:in `/^(?:I|they|"([^"]*?)") should receive (an|no|\d+) emails?$/'
features/request_for_condition_reports.feature:18:in `And I should receive an email'
When I open the email # features/step_definitions/email_steps.rb:72
Then I should see "Ramon (ramon@email.com) wants a condition report for" in the email body

这是发送电子邮件的类:
class ReportRequest < ActiveRecord::Base
...

private

def notify_admin
Mailer.condition_report_request_to_admin(self).deliver
end
end

我该怎么做才能修复此测试?

谢谢!

最佳答案

看来我wasn't the only one遇到了这个问题!您应该将在email_steps.rb中设置的默认电子邮件更改为希望接收电子邮件的电子邮件。

关于ruby-on-rails - cucumber + EmailSpec + Rails3:为什么说在实际工作时没有发送电子邮件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4244548/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com