What's the best way to test delayed_job chains with rSpec?

后端 未结 3 743
天命终不由人
天命终不由人 2021-02-13 20:41

Currently when I have a delayed method in my code like the following:

CommentMailer.delay.deliver_comments(@comment, true)

I write something li

3条回答
  •  伪装坚强ぢ
    2021-02-13 21:09

    We can just have one more line in the before block as following:

    CommentMailer.stub(:delay).and_return(CommentMailer)
    

    Then you then can have the normal mock check as following:

    CommentMailer.should_receive(:deliver_comments).with(comment, true)
    

提交回复
热议问题