我想断言调用了一个特定的方法,但我不想模拟/存根该方法 - 我也想在测试中包含该代码。
例如,在 Ruby 中,类似:
def bar()
#stuff I want to test
end
def foo()
if condition
bar()
end
#more stuff I want to test
end
# The test:
foo()
assert_called :bar
有没有人有建议(或更好的方法)?我的实际代码要复杂得多,所以请不要考虑示例的简单性。