aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/test_case.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/test_case.rb')
-rw-r--r--lib/rubygems/test_case.rb23
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index 1e6d9feeeb..19d3cfd134 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -1117,25 +1117,46 @@ Also, a list:
return name, vendor_spec.version, directory
end
+ ##
+ # The StaticSet is a static set of gem specifications used for testing only.
+ # It is available by requiring Gem::TestCase.
+
class StaticSet
+
+ ##
+ # Creates a new StaticSet for the given +specs+
+
def initialize(specs)
@specs = specs
end
+ ##
+ # Adds +spec+ to this set.
+
def add spec
@specs << spec
end
+ ##
+ # Finds +dep+ in this set.
+
def find_spec(dep)
@specs.reverse_each do |s|
return s if dep.matches_spec? s
end
end
+ ##
+ # Finds all gems matching +dep+ in this set.
+
def find_all(dep)
@specs.find_all { |s| dep.matches_spec? s }
end
+ ##
+ # Loads a Gem::Specification from this set which has the given +name+,
+ # version +ver+, +platform+. The +source+ is ignored.
+
def load_spec name, ver, platform, source
dep = Gem::Dependency.new name, ver
spec = find_spec dep
@@ -1145,7 +1166,7 @@ Also, a list:
end
end
- def prefetch(reqs)
+ def prefetch reqs # :nodoc:
end
end