mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02: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.
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…
Add table
Add a link
Reference in a new issue