RubyGemTestCase provides a variety of methods for testing rubygems and gem-related behavior in a sandbox. Through RubyGemTestCase you can install and uninstall gems, fetch remote gems through a stub fetcher and be assured your normal set of gems is not affected.

Tests are always run at a safe level of 1.

Class Methods

Returns the path to the certificate named cert_name from test/rubygems/.

Returns the path to the key named key_name from test/rubygems

Loads certificate named cert_name from test/rubygems/.

Loads an RSA private key named key_name with passphrase in test/rubygems/

Returns the make command for the current platform. For versions of Ruby built on MS Windows with VC++ or Borland it will return ‘nmake’. On all other platforms, including Cygwin, it will return ‘make’.

Allows tests to use a random (but controlled) port number instead of a hardcoded one. This helps CI tools when running parallels builds on the same builder slave.

Finds the path to the Ruby executable

Returns whether or not we’re on a version of Ruby built with VC++ (or Borland) versus Cygwin, Mingw, etc.

Is this test being run on a Windows platform?

Instance Methods

Add spec to +@fetcher+ serving the data in the file path. repo indicates which repo to make spec appear to be in.

No documentation available
No documentation available
No documentation available
No documentation available

TODO: move to minitest

Allows the proper version of rake to be used for the test.

No documentation available
No documentation available

creates a temporary directory with hax TODO: deprecate and remove

Construct a new Gem::Dependency.

Constructs a Gem::Resolver::DependencyRequest from a Gem::Dependency dep, a from_name and from_version requesting the dependency and a parent DependencyRequest

Sets the ENABLE_SHARED entry in RbConfig::CONFIG to value and restores the original value when the block ends

A git_gem is used with a gem dependencies file. The gem created here has no files, just a gem specification for the given name and version.

Yields the specification to the block, if given

Skips this test unless you have a git executable

Installs the provided default specs including writing the spec file

Install the provided default specs

Builds and installs the Gem::Specification spec

Builds and installs the Gem::Specification spec into the user dir

Install the provided specs

No documentation available

Returns the make command for the current platform. For versions of Ruby built on MS Windows with VC++ or Borland it will return ‘nmake’. On all other platforms, including Cygwin, it will return ‘make’.

Enables pretty-print for all tests

No documentation available

Returns whether or not the nmake command could be found.

No documentation available

Creates a Gem::Specification with a minimum of extra work. name and version are the gem’s name and version, platform, author, email, homepage, summary and description are defaulted. The specification is yielded for customization.

The gem is added to the installed gems in +@gemhome+ and the runtime.

Use this with write_file to build an installed gem.

Reads a binary file at path

Reads a Marshal file at path

TODO: move to minitest

Constructs a new Gem::Requirement.

create_gemspec creates gem specification in given directory or ‘.’ for the given name and version.

Yields the specification to the block, if given

No documentation available
No documentation available

setup prepares a sandboxed location to install gems. All installs are directed to a temporary directory. All install plugins are removed.

If the RUBY environment variable is set the given path is used for Gem::ruby. The local platform is set to i386-mswin32 for Windows or i686-darwin8.10.1 otherwise.

If the KEEP_FILES environment variable is set the files will not be removed from /tmp/test_rubygems_#{$$}.#{Time.now.to_i}.

Constructs a new Gem::Specification.

Creates a SpecFetcher pre-filled with the gems or specs defined in the block.

Yields a fetcher object that responds to spec and gem. spec adds a specification to the SpecFetcher while gem adds both a specification and the gem data to the RemoteFetcher so the built gem can be downloaded.

If only the a-3 gem is supposed to be downloaded you can save setup time by creating only specs for the other versions:

spec_fetcher do |fetcher|
  fetcher.spec 'a', 1
  fetcher.spec 'a', 2, 'b' => 3 # dependency on b = 3
  fetcher.gem 'a', 3 do |spec|
    # spec is a Gem::Specification
    # ...
  end
end

teardown restores the process to its original state and removes the tempdir unless the KEEP_FILES environment variable was set.

Uninstalls the Gem::Specification spec

No documentation available

Builds a gem from spec and places it in File.join @gemhome, 'cache'. Automatically creates files based on spec.files

Removes all installed gems from +@gemhome+.

Creates a gem with name, version and deps. The specification will be yielded before gem creation for customization. The gem will be placed in File.join @tempdir, 'gems'. The specification and .gem file location are returned.

Gzips data.

Creates several default gems which all have a lib/code.rb file. The gems are not installed but are available in the cache dir.

+@a1+

gem a version 1, this is the best-described gem.

+@a2+

gem a version 2

+@a3a

gem a version 3.a

+@a_evil9+

gem a_evil version 9, use this to ensure similarly-named gems don’t collide with a.

+@b2+

gem b version 2

+@c1_2+

gem c version 1.2

+@pl1+

gem pl version 1, this gem has a legacy platform of i386-linux.

Additional prerelease gems may also be created:

+@a2_pre+

gem a version 2.a

TODO: nuke this and fix tests. this should speed up a lot

No documentation available
No documentation available
No documentation available

Set the platform to arch

Sets up a fake fetcher using the gems from util_make_gems. Optionally additional prerelease gems may be included.

Gems created by this method may be fetched using Gem::RemoteFetcher.

Sets up Gem::SpecFetcher to return information from the gems in specs. Best used with +@all_gems+ from util_setup_fake_fetcher.

Creates a spec with name, version. deps can specify the dependency or a block can be given for full customization of the specification.

Deflates data

Construct a new Gem::Version.

Returns whether or not we’re on a version of Ruby built with VC++ (or Borland) versus Cygwin, Mingw, etc.

A vendor_gem is used with a gem dependencies file. The gem created here has no files, just a gem specification for the given name and version.

Yields the specification to the block, if given

In case we’re building docs in a background process, this method waits for that process to exit (or if it’s already been reaped, or never happened, swallows the Errno::ECHILD error).

Is this test being run on a Windows platform?

Writes a binary file to path which is relative to +@gemhome+