【发布时间】:2018-03-15 00:12:24
【问题描述】:
毕竟我有一个设置延迟工作的方法:
def method
...
RunsJob.set(wait_until: target_date).perform_later(id)
end
当我编写规范时,我调用 method 并得到:
Failure/Error: RunsJob.set(wait_until: target_date).perform_later(id)
NotImplementedError:
Use a queueing backend to enqueue jobs in the future. Read more at http://guides.rubyonrails.org/active_job_basics.html
我用
gem 'sidekiq'
group :test do
gem 'rspec-sidekiq'
end
如何通过考试?
【问题讨论】:
-
@SergioTulentsev 不幸的是,这两个指南都没有帮助。
-
不幸的是,这并没有告诉我任何事情。我敢打赌,您错过了 ActiveJob 指南中的一些步骤。
-
两个指南都描述了如何在测试中使用 sideq 或 ActiveJob,以及它们为测试作业提供了哪些工具。但就我而言,我不需要测试 Job,我只需要避免错误
标签: ruby-on-rails rspec sidekiq