2016-11-10 63 views
1

我试图在Rspec中剔除一个ActiveJob方法,但我真的不能摆弄它。我正在为Mailchimp发送电子邮件,这是MailingListUnsubscribeJob。电话是:存根设置稍后perform_later ActiveJob

MailingListUnsubscribeJob.set(wait: 20.days).perform_later(subject: user, list: "activation") 

通常我在做Rspec的没有当set(wait: 20.days)但我只是perform_later我做了以下在我的规格:

allow(MailingListUnsubscribeJob).to receive(:perform_later) 

,但它不工作。 有什么想法?

回答

1

由于您已经在使用RSpec,因此您可以使用rpec-activejob

matchers you need

如果你的作业使用set(wait_until: time),以后还可以enqueue_a通话使用.to_run_at(time) 链以及。

相关问题