Class: Gem::TestCase::SpecFetcherSetup
| Relationships & Source Files | |
| Inherits: | Object | 
| Defined in: | lib/rubygems/test_utilities.rb | 
Overview
The SpecFetcherSetup allows easy setup of a remote source in RubyGems tests:
spec_fetcher do |f|
  f.gem  'a', 1
  f.spec 'a', 2
  f.gem  'b', 1' 'a' => '~> 1.0'
  f.clear
endThe above declaration creates two gems, a-1 and b-1, with a dependency from b to a. The declaration creates an additional spec a-2, but no gem for it (so it cannot be installed).
After the gems are created they are removed from Gem.dir.
Class Method Summary
- 
    
      .declare(test, repository) {|setup| ... } 
    
    Executes a ::Gem::SpecFetcher setup block. 
Instance Method Summary
- 
    
      #clear  
    
    Removes any created gems or specifications from Gem.dir (the default install location). 
- 
    
      #created_specs  
    
    Returns a Hash of created ::Gem::Specification full names and the corresponding ::Gem::Specification. 
- 
    
      #gem(name, version, dependencies = nil, &block)  
    
    Creates a gem with name,versionanddeps.
- 
    
      #legacy_platform  
    
    Creates a legacy platform spec with the name 'pl' and version 1. 
- 
    
      #spec(name, version, dependencies = nil, &block)  
    
    Creates a spec with name,versionanddeps.
Class Method Details
.declare(test, repository) {|setup| ... }
Executes a ::Gem::SpecFetcher setup block. Yields an instance then creates the gems and specifications defined in the instance.
Instance Method Details
#clear
Removes any created gems or specifications from Gem.dir (the default install location).
# File 'lib/rubygems/test_utilities.rb', line 225
def clear @operations << [:clear] end
#created_specs
Returns a Hash of created ::Gem::Specification full names and the corresponding ::Gem::Specification.
#gem(name, version, dependencies = nil, &block)
Creates a gem with name, version and deps.  The created gem can be downloaded and installed.
The specification will be yielded before gem creation for customization, but only the block or the dependencies may be set, not both.
# File 'lib/rubygems/test_utilities.rb', line 285
def gem name, version, dependencies = nil, &block @operations << [:gem, name, version, dependencies, block] end
#legacy_platform
Creates a legacy platform spec with the name 'pl' and version 1
#spec(name, version, dependencies = nil, &block)
Creates a spec with name, version and deps.  The created gem can be downloaded and installed.
The specification will be yielded before creation for customization, but only the block or the dependencies may be set, not both.
# File 'lib/rubygems/test_utilities.rb', line 343
def spec name, version, dependencies = nil, &block @operations << [:spec, name, version, dependencies, block] end