Chain should_receive Maybe?

Is there an easier way to write this rspec code?

mailer = double AdminMailer.should_receive(:request_failed).with(@request).and_return(mailer) mailer.should_receive(:deliver) 

I imagine something like this:

 AdminMailer .should_receive(:request_failed) .with(@request) .should_receive(:deliver) 
+4
source share
1 answer

I do not think this is possible, but even if it is, I would not recommend it. Your specifications should clearly show what you expect from your code, and your first example already does this in a rather concise way!

+1
source

Source: https://habr.com/ru/post/1480754/


All Articles