Later in the test, are you testing that the email has been delivered?
Not in this case. If I'd have to test that the email has been delivered, I'd assign it and verify:
last_deadline_warning_email=double(...)# or instance_doubleallow(DeadlineMailer).toreceive(:last_deadline_warning).and_return(last_deadline_warning_email)# ...expect(last_deadling_warning_email).tohave_received(:deliver_later)
In this particular case I simply stub emails in order to speed up tests. Consider the following example:
Not in this case. If I'd have to test that the email has been delivered, I'd assign it and verify:
In this particular case I simply stub emails in order to speed up tests. Consider the following example:
Without stub we'd have to render and send deadline email 4 times which could be expensive and time consuming.