Mock
expect
verify# Expect that method name is called, optionally with args or a blk, and returns retval.
m = Minitest::Mock.new
m.expect(:raiser, nil) do |args|
raise RuntimeError, "this code path triggers an exception"
enduser = Minitest::Mock.new
user.expect(:delete, true) # returns true, expects no args
UserDestoyer.new.delete_user(user)
assert user.verify最后更新于