运行测试时会出现以下错误
不支持在每个测试生命周期之外使用来自rspec-模拟的双倍或部分双倍。
describe 'foo_bar'
require 'sidekiq/testing'
around(:example) do |example|
allow_any_instance_of(FooRunner).to receive(:next_tick)
Sidekiq::Testing.inline! do
example.run
end
end
it ' ....' do
end
end我该如何解决这个问题?
发布于 2014-09-28 01:59:38
我通过在before(:example)钩子中添加double来解决这个问题。
around(:example) do |example|
Sidekiq::Testing.inline! do
example.run
end
end
before(:example) do |example|
allow_any_instance_of(FooRunner).to receive(:next_tick)
endhttps://stackoverflow.com/questions/25924491
复制相似问题