未验证 提交 38b2904f 编写于 作者: R Ryuta Kamizono 提交者: GitHub

Merge pull request #31411 from eugeneius/time_helpers_redefine_method

Prevent race condition when resetting time stubs
# frozen_string_literal: true
require "active_support/core_ext/module/redefine_method"
require "active_support/core_ext/string/strip" # for strip_heredoc
require "active_support/core_ext/time/calculations"
require "concurrent/map"
......@@ -43,7 +44,7 @@ def stubbing(object, method_name)
def unstub_object(stub)
singleton_class = stub.object.singleton_class
singleton_class.send :undef_method, stub.method_name
singleton_class.send :silence_redefinition_of_method, stub.method_name
singleton_class.send :alias_method, stub.method_name, stub.original_method
singleton_class.send :undef_method, stub.original_method
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册