如何断言一个块被接收

时间:2018-10-24 09:08:23

标签: rspec

class Foo
  def self.cool_async
    Concurrent::Future.execute do
      method_1
      method_2
    end
  end

  def self.method_1
  end

  def self.method_2
  end
end


it 'spawns a background thread to execute method_1 and method_2'
  expect(Concurrent::Future).receive(execute)
  # I am stuck with asserting execute is getting method_1 and method_2 as block
  Foo.cool_async
end

我正在尝试断言,如果Concurrent :: Future的执行正在接收带有method1和method2的块。我该如何断言?

0 个答案:

没有答案