Skip to content

Commit f1af59f

Browse files
committed
Removed minitest/mock from test/rubygems/test_gem_remote_fetcher.rb
1 parent 45464bf commit f1af59f

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

lib/rubygems/test_case.rb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,4 +1557,37 @@ def self.key_path(key_name)
15571557
end if Gem::HAVE_OPENSSL
15581558
end
15591559

1560+
class Object
1561+
def stub name, val_or_callable, *block_args
1562+
new_name = "__minitest_stub__#{name}"
1563+
1564+
metaclass = class << self; self; end
1565+
1566+
if respond_to? name and not methods.map(&:to_s).include? name.to_s then
1567+
metaclass.send :define_method, name do |*args|
1568+
super(*args)
1569+
end
1570+
end
1571+
1572+
metaclass.send :alias_method, new_name, name
1573+
1574+
metaclass.send :define_method, name do |*args, &blk|
1575+
if val_or_callable.respond_to? :call then
1576+
val_or_callable.call(*args, &blk)
1577+
else
1578+
blk.call(*block_args) if blk
1579+
val_or_callable
1580+
end
1581+
end
1582+
1583+
metaclass.send(:ruby2_keywords, name) if metaclass.respond_to?(:ruby2_keywords, true)
1584+
1585+
yield self
1586+
ensure
1587+
metaclass.send :undef_method, name
1588+
metaclass.send :alias_method, name, new_name
1589+
metaclass.send :undef_method, new_name
1590+
end
1591+
end
1592+
15601593
require 'rubygems/test_utilities'

test/rubygems/test_gem_remote_fetcher.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
require 'rubygems/remote_fetcher'
1212
require 'rubygems/package'
13-
require 'minitest/mock'
1413

1514
# = Testing Proxy Settings
1615
#

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy