0
如果我有像存根與塊一類作爲參數在構造
class MyClass
def initialize(&block)
@myBlock = block
end
def process
#...
@myBlock.call
#..
end
一個類和我想測試一DifferentClass
其需要使用MyClass
因而在new
接收的塊。
我該如何對該塊進行存根?在這種情況下我能做些什麼?