I use EmailSpec to check email with Cucumber. My tests fail and say that no email is sent, but I could not find something wrong with my code, so I tried it in production and sent emails .
Here's the failure:
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."
And I should receive an email
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
And here is the class that sends the email:
class ReportRequest < ActiveRecord::Base
...
private
def notify_admin
Mailer.condition_report_request_to_admin(self).deliver
end
end
What should I do to fix this test?
Thank!
source
share