mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
[rubygems/rubygems] Improve source list management testing
This approach better simulate that ["http://gems.example.com/"] is the default list of sources, rather than ["https://rubygems.org/"]. https://github.com/rubygems/rubygems/commit/55130c259a
This commit is contained in:
parent
2d3fd1fd28
commit
cbd0de84f6
@ -13,7 +13,7 @@ module Gem
|
||||
# An Array of the default sources that come with RubyGems
|
||||
|
||||
def self.default_sources
|
||||
%w[https://rubygems.org/]
|
||||
@default_sources ||= %w[https://rubygems.org/]
|
||||
end
|
||||
|
||||
##
|
||||
|
||||
@ -400,8 +400,9 @@ class Gem::TestCase < Test::Unit::TestCase
|
||||
Gem::RemoteFetcher.fetcher = Gem::FakeFetcher.new
|
||||
|
||||
@gem_repo = "http://gems.example.com/"
|
||||
Gem.instance_variable_set :@default_sources, [@gem_repo]
|
||||
Gem.instance_variable_set :@sources, nil
|
||||
@uri = Gem::URI.parse @gem_repo
|
||||
Gem.sources.replace [@gem_repo]
|
||||
|
||||
Gem.searcher = nil
|
||||
Gem::SpecFetcher.fetcher = nil
|
||||
|
||||
@ -586,6 +586,7 @@ class TestGem < Gem::TestCase
|
||||
end
|
||||
|
||||
def test_self_default_sources
|
||||
Gem.remove_instance_variable :@default_sources
|
||||
assert_equal %w[https://rubygems.org/], Gem.default_sources
|
||||
end
|
||||
|
||||
@ -1198,6 +1199,8 @@ class TestGem < Gem::TestCase
|
||||
Gem.sources = nil
|
||||
Gem.configuration.sources = %w[http://test.example.com/]
|
||||
assert_equal %w[http://test.example.com/], Gem.sources
|
||||
ensure
|
||||
Gem.configuration.sources = nil
|
||||
end
|
||||
|
||||
def test_try_activate_returns_true_for_activated_specs
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user