diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-25 10:13:50 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-25 10:13:50 +0000 |
commit | d478c7a7342478847cc1148f4134b5f0db04e1d9 (patch) | |
tree | 3bfca425683a94d1360ecdf5857d741b8eaac213 /lib/rubygems/test_utilities.rb | |
parent | 788001a9c8473130bd357846785838045387b060 (diff) |
Update to RubyGems 1.3.0 r1891
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/test_utilities.rb')
-rw-r--r-- | lib/rubygems/test_utilities.rb | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/rubygems/test_utilities.rb b/lib/rubygems/test_utilities.rb index e8709b9be3..8b23d3236e 100644 --- a/lib/rubygems/test_utilities.rb +++ b/lib/rubygems/test_utilities.rb @@ -34,16 +34,20 @@ class Gem::FakeFetcher path = path.to_s @paths << path raise ArgumentError, 'need full URI' unless path =~ %r'^http://' - data = @data[path] - if data.nil? then - raise Gem::RemoteFetcher::FetchError.new('no data', path) + unless @data.key? path then + raise Gem::RemoteFetcher::FetchError.new("no data for #{path}", path) end + data = @data[path] + if data.respond_to?(:call) then data.call else - data = Gem.gunzip data if path.to_s =~ /gz$/ unless data.empty? + if path.to_s =~ /gz$/ and not data.nil? and not data.empty? then + data = Gem.gunzip data + end + data end end @@ -51,13 +55,15 @@ class Gem::FakeFetcher def fetch_size(path) path = path.to_s @paths << path + raise ArgumentError, 'need full URI' unless path =~ %r'^http://' - data = @data[path] - if data.nil? then - raise Gem::RemoteFetcher::FetchError.new("no data for #{path}", nil) + unless @data.key? path then + raise Gem::RemoteFetcher::FetchError.new("no data for #{path}", path) end + data = @data[path] + data.respond_to?(:call) ? data.call : data.length end |