Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Pong. Filled out tests for RemoteFetcher#request.

git-svn-id: http://rubygems.rubyforge.org/svn/trunk@1799 3d4018f9-ac1a-0410-99e9-8a154d859a19
  • Loading branch information...
commit ecd6a4fff6ca9b4059f3daf5f9bb817bee1aa1d3 1 parent 2e00928
drbrain authored
Showing with 21 additions and 2 deletions.
  1. +0 −2  lib/rubygems/remote_fetcher.rb
  2. +21 −0 test/test_gem_remote_fetcher.rb
View
2  lib/rubygems/remote_fetcher.rb
@@ -175,8 +175,6 @@ def fetch_size(uri)
raise FetchError.new("#{e.message} (#{e.class})\n\tfetching size", uri)
end
- private
-
def escape(str)
return unless str
URI.escape(str)
View
21 test/test_gem_remote_fetcher.rb
@@ -106,6 +106,8 @@ def setup
@a1, @a1_gem = util_gem 'a', '1' do |s| s.executables << 'a_bin' end
Gem::RemoteFetcher.fetcher = nil
+
+ @fetcher = Gem::RemoteFetcher.fetcher
end
def test_self_fetcher
@@ -117,7 +119,10 @@ def test_self_fetcher
def test_self_fetcher_with_proxy
proxy_uri = 'http://proxy.example.com'
Gem.configuration[:http_proxy] = proxy_uri
+ Gem::RemoteFetcher.fetcher = nil
+
fetcher = Gem::RemoteFetcher.fetcher
+
assert_not_nil fetcher
assert_kind_of Gem::RemoteFetcher, fetcher
assert_equal proxy_uri, fetcher.instance_variable_get(:@proxy_uri).to_s
@@ -503,6 +508,22 @@ def conn.request(req)
end
def test_request
+ uri = URI.parse "#{@gem_repo}/specs.#{Gem.marshal_version}"
+ response = @fetcher.request uri
+
+ assert_equal 200, response.code
+ assert_equal :junk, response.body
+
+ flunk "we suck"
+ end
+
+ def test_request_head
+ uri = URI.parse "#{@gem_repo}/specs.#{Gem.marshal_version}"
+ response = @fetcher.request uri, Net::HTTP::Head
+
+ assert_equal 200, response.code
+ assert_equal '', response.body
+
flunk "we suck"
end
Please sign in to comment.
Something went wrong with that request. Please try again.