我正在使用rspec-sidekiq
gem ( https://github.com/philostler/rspec-sidekiq ) 来帮助测试我正在编写的工人,但由于某种原因,我的测试一直失败。
这是我的测试:
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)>'
我在他们的 wiki 上基于他们的示例进行了低级测试,但它对我不起作用……有什么理由不起作用?