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的块。我该如何断言?