summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_commands_sources_command.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2019-06-01 12:45:11 +0300
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-06-01 13:50:41 +0300
commit56660de3c6df7a4ff8667ef4047d30d0de169935 (patch)
treedd1e526075687b4b24e089cee50eabc21a6143cc /test/rubygems/test_gem_commands_sources_command.rb
parent560cd5b1f04f30542a294b3d77527d3b12f7cc15 (diff)
downloadruby-56660de3c6df7a4ff8667ef4047d30d0de169935.tar.gz
Merge rubygems master from upstream.
I picked the commit from 3c469e0da538428a0ddd94f99aa73c32da22e8ba
Diffstat (limited to 'test/rubygems/test_gem_commands_sources_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_sources_command.rb18
1 files changed, 16 insertions, 2 deletions
diff --git a/test/rubygems/test_gem_commands_sources_command.rb b/test/rubygems/test_gem_commands_sources_command.rb
index 1e58643566..36e6ee9293 100644
--- a/test/rubygems/test_gem_commands_sources_command.rb
+++ b/test/rubygems/test_gem_commands_sources_command.rb
@@ -7,11 +7,17 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
def setup
super
- spec_fetcher
-
@cmd = Gem::Commands::SourcesCommand.new
@new_repo = "http://beta-gems.example.com"
+
+ @old_https_proxy_config = Gem.configuration[:http_proxy]
+ end
+
+ def teardown
+ Gem.configuration[:http_proxy] = @old_https_proxy_config
+
+ super
end
def test_initialize_proxy
@@ -69,6 +75,8 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
end
def test_execute_add_nonexistent_source
+ spec_fetcher
+
uri = "http://beta-gems.example.com/specs.#{@marshal_version}.gz"
@fetcher.data[uri] = proc do
raise Gem::RemoteFetcher::FetchError.new('it died', uri)
@@ -92,6 +100,8 @@ Error fetching http://beta-gems.example.com:
end
def test_execute_add_redundant_source
+ spec_fetcher
+
@cmd.handle_options %W[--add #{@gem_repo}]
use_ui @ui do
@@ -109,6 +119,8 @@ source #{@gem_repo} already present in the cache
end
def test_execute_add_redundant_source_trailing_slash
+ spec_fetcher
+
# Remove pre-existing gem source (w/ slash)
repo_with_slash = "http://gems.example.com/"
@cmd.handle_options %W[--remove #{repo_with_slash}]
@@ -266,6 +278,8 @@ beta-gems.example.com is not a URI
end
def test_execute_remove_no_network
+ spec_fetcher
+
@cmd.handle_options %W[--remove #{@gem_repo}]
@fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] = proc do