【发布时间】:2012-06-07 19:47:15
【问题描述】:
我想用 minitest Ruby 测试一个函数是否正确调用了其他函数,但是我找不到合适的 assert 从 doc 进行测试。
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
【问题讨论】:
标签: ruby unit-testing testing minitest