I want to stub sending email and return sample email result for further process.
Given I have:
message = GenericMailer.send_notification(id).deliver!
I want to do something like:
allow(GenericMailer).to receive_message_chain(:send_notification, :deliver)
.and_return(mail_result_no_idea_what_is_like)
but above function obviously fails, GenericMailer does not implement: deliver
or deliver! as tried.
I want to return some data as i need to test something like (and more):
message.header.select{|h| h.name == "Date"}.try(:first).try(:value).try(:to_datetime).try(:utc)
:deliver
to:deliver!
? – Stranglehold