【发布时间】:2013-10-02 19:57:47
【问题描述】:
我需要部分模拟:
class Post
def meth1; meth2; end
def meth2; nil; end
end
real_model = Post.new
mock_model = SomeMock.new real_model
mock_model.expect :meth1, true
mock_model.validate
mock_model.verify # should return true if #meth2 has worked and false otherwise
有 SimpleMock (https://github.com/tatey/simple_mock) 但似乎 不接受部分嘲笑: https://github.com/tatey/simple_mock/issues/3
你能帮帮我吗?谢谢
【问题讨论】:
标签: ruby unit-testing mocking