aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems/test_gem_remote_fetcher.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rubygems/test_gem_remote_fetcher.rb')
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/rubygems/test_gem_remote_fetcher.rb b/test/rubygems/test_gem_remote_fetcher.rb
index 3f135ba046..465443c901 100644
--- a/test/rubygems/test_gem_remote_fetcher.rb
+++ b/test/rubygems/test_gem_remote_fetcher.rb
@@ -151,7 +151,7 @@ gems:
fetcher.fetch_size 'gems.example.com/yaml'
end
- assert_equal 'uri is not an HTTP URI', e.message
+ assert_equal 'uri scheme is invalid', e.message
end
def test_fetch_size_socket_error
@@ -237,6 +237,21 @@ gems:
inst.download(@a1, local_path)
end
+ def test_download_local_space
+ space_path = File.join @tempdir, 'space path'
+ FileUtils.mkdir space_path
+ FileUtils.mv @a1_gem, space_path
+ local_path = File.join space_path, "#{@a1.full_name}.gem"
+ inst = nil
+
+ Dir.chdir @tempdir do
+ inst = Gem::RemoteFetcher.fetcher
+ end
+
+ assert_equal File.join(@gemhome, 'cache', "#{@a1.full_name}.gem"),
+ inst.download(@a1, local_path)
+ end
+
def test_download_install_dir
a1_data = nil
File.open @a1_gem, 'rb' do |fp|
@@ -463,6 +478,13 @@ gems:
assert_equal nil, fetcher.fetch_path(URI.parse(@gem_repo), Time.at(0))
end
+ def test_get_proxy_from_env_auto_normalizes
+ fetcher = Gem::RemoteFetcher.new(nil)
+ ENV['HTTP_PROXY'] = 'fakeurl:12345'
+
+ assert_equal('http://fakeurl:12345', fetcher.get_proxy_from_env.to_s)
+ end
+
def test_get_proxy_from_env_empty
orig_env_HTTP_PROXY = ENV['HTTP_PROXY']
orig_env_http_proxy = ENV['http_proxy']