mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Little refactor to avoid rubocop's false positive
Otherwise it detects duplicate methods here, because it doesn't see that we are reopening the class in two different places. https://github.com/rubygems/rubygems/commit/ae3fb47f5f
This commit is contained in:
parent
d84b9b6d0a
commit
f9f6a3d793
1 changed files with 8 additions and 6 deletions
|
@ -27,25 +27,21 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|||
|
||||
@cmd = Gem::Commands::PushCommand.new
|
||||
|
||||
class << Gem
|
||||
|
||||
singleton_gem_class.class_eval do
|
||||
alias_method :orig_latest_rubygems_version, :latest_rubygems_version
|
||||
|
||||
def latest_rubygems_version
|
||||
Gem.rubygems_version
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def teardown
|
||||
super
|
||||
|
||||
class << Gem
|
||||
|
||||
singleton_gem_class.class_eval do
|
||||
remove_method :latest_rubygems_version
|
||||
alias_method :latest_rubygems_version, :orig_latest_rubygems_version
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -404,4 +400,10 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|||
assert_equal '111111', @fetcher.last_request['OTP']
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def singleton_gem_class
|
||||
class << Gem; self; end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue