Я использую 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
Что я должен сделать, чтобы исправить этот тест?
Спасибо!