class Gem::TestCase

def util_spec name, version = 2, deps = nil # :yields: specification

:yields: specification
def util_spec name, version = 2, deps = nil # :yields: specification
  raise "deps or block, not both" if deps and block_given?
  spec = Gem::Specification.new do |s|
    s.platform    = Gem::Platform::RUBY
    s.name        = name
    s.version     = version
    s.author      = 'A User'
    s.email       = 'example@example.com'
    s.homepage    = 'http://example.com'
    s.summary     = "this is a summary"
    s.description = "This is a test description"
    yield s if block_given?
  end
  if deps then
    # Since Hash#each is unordered in 1.8, sort the keys and iterate that
    # way so the tests are deterministic on all implementations.
    deps.keys.sort.each do |n|
      spec.add_dependency n, (deps[n] || '>= 0')
    end
  end
  Gem::Specification.reset
  return spec
end