mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Removed minitest/mock from test/rubygems/test_gem_remote_fetcher.rb
https://github.com/rubygems/rubygems/commit/f1af59fe02
This commit is contained in:
parent
ff3f990499
commit
3456335a9c
Notes:
git
2021-05-12 17:25:18 +09:00
2 changed files with 33 additions and 1 deletions
|
@ -1557,4 +1557,37 @@ Also, a list:
|
|||
end if Gem::HAVE_OPENSSL
|
||||
end
|
||||
|
||||
class Object
|
||||
def stub name, val_or_callable, *block_args
|
||||
new_name = "__minitest_stub__#{name}"
|
||||
|
||||
metaclass = class << self; self; end
|
||||
|
||||
if respond_to? name and not methods.map(&:to_s).include? name.to_s then
|
||||
metaclass.send :define_method, name do |*args|
|
||||
super(*args)
|
||||
end
|
||||
end
|
||||
|
||||
metaclass.send :alias_method, new_name, name
|
||||
|
||||
metaclass.send :define_method, name do |*args, &blk|
|
||||
if val_or_callable.respond_to? :call then
|
||||
val_or_callable.call(*args, &blk)
|
||||
else
|
||||
blk.call(*block_args) if blk
|
||||
val_or_callable
|
||||
end
|
||||
end
|
||||
|
||||
metaclass.send(:ruby2_keywords, name) if metaclass.respond_to?(:ruby2_keywords, true)
|
||||
|
||||
yield self
|
||||
ensure
|
||||
metaclass.send :undef_method, name
|
||||
metaclass.send :alias_method, name, new_name
|
||||
metaclass.send :undef_method, new_name
|
||||
end
|
||||
end
|
||||
|
||||
require 'rubygems/test_utilities'
|
||||
|
|
|
@ -10,7 +10,6 @@ end
|
|||
|
||||
require 'rubygems/remote_fetcher'
|
||||
require 'rubygems/package'
|
||||
require 'minitest/mock'
|
||||
|
||||
# = Testing Proxy Settings
|
||||
#
|
||||
|
|
Loading…
Add table
Reference in a new issue