我想测试一个函数是否使用 minitest Ruby 正确调用其他函数,但我无法从docassert
中找到合适的测试对象。
class SomeClass
def invoke_function(name)
name == "right" ? right () : wrong ()
end
def right
#...
end
def wrong
#...
end
end
测试代码:
describe SomeClass do
it "should invoke right function" do
# assert right() is called
end
it "should invoke other function" do
# assert wrong() is called
end
end