我正在使用rspec-sidekiq
宝石库(https://github.com/philostler/rspec-sidekiq)来帮助测试我编写的一个worker,但出现了一些原因导致我的测试失败。
这是我的测试内容:
require 'spec_helper'
describe CommunicationWorker do
it { should be_retryable false }
it "enqueues a communication worker" do
subject.perform("foo@bar.com", "bar@foo.com", [1,2,3])
expect(CommunicationWorker).to have_enqueued_jobs(1)
end
end
这是错误内容:
1) CommunicationWorker enqueues a communication worker
Failure/Error: expect(CommunicationWorker).to have_enqueued_jobs(1)
expected CommunicationWorker to have 1 enqueued job but got 0
# ./spec/workers/communication_worker_spec.rb:9:in `block (2 levels) in <top (required)>'
我根据他们在维基上的示例进行了低级别测试,但对我来说它不起作用...有什么原因会导致它不起作用?