« Previous -
Version 14/18
(diff) -
Next » -
Current version
Brian Ford, 02/05/2009 11:15 PM
Getting Started
To run the RubySpecs, you need to get MSpec and the RubySpec files.
Getting MSpec
MSpec is the framework and scripts for running the RubySpecs. It is available as a gem or directly from Github.
sudo gem install mspec
OR
git clone git://github.com/rubyspec/mspec.git
Getting the RubySpecs
The RubySpec source is available from Github.
git clone git://github.com/rubyspec/rubyspec.git
Running the RubySpecs
If you cloned MSpec from Github, put the mspec/bin directory in your PATH. The simplest way to run the specs is to change to the RubySpec directory and invoke mspec.
$ cd rubyspec $ mspec
This will run the specs with the ruby executable on PATH. To run the specs with a different implementation, see the -t or --target option to mspec. See mspec -h for more details. Read the Runners documentation for complete details on all the runner scripts.
To run a single directory of specs, pass the path to the directory to mspec. To run a single file, pass the name of the file.
$ cd rubyspec $ mspec core/array $ mspec core/array/append_spec.rb
The ruby.1.8.mspec and ruby.1.9.mspec config files also provide psuedo-directories that will include all the appropriate files for the version.
$ mspec :core $ mspec :library $ mspec :language
The psuedo-directory for :library is the most useful since there are both 1.8 and 1.9 specific libraries in the rubyspec/library directory.
Issues for Ruby 1.9
There are two main problems running the specs on Ruby 1.9:
- Ruby 1.9 changes language features and many core library methods.
- Potential bugs in the Ruby 1.9
The RubySpecs were initially written for Ruby 1.8. Many of the specs work fine with 1.9. However, many of the specs fail on 1.9 because the specs need to be updated. To facilitate the process of updating the specs for 1.9, tags for failures have been added to the RubySpec source.
MSpec provides a special runner script that will read the tags and NOT run specs that fail. You can also exclude tagged specs with the default runner script.
Specs are tagged with 'fails' and 'critical'. Specs tagged as critical are specs that either cause hangs or segfaults.
To run all the specs but exclude failing ones:
$ cd rubyspec $ mspec ci -tr19
To run specs but exclude a particular tag:
$ mspec -tr19 -G critical $ mspec -tr19 -G fails $ mspec -tr19 -G critical -G fails
To run only the specs with a particular tag:
$ mspec -tr19 -g critical $ mspec -tr19 -g fails core/array
Removing tags
Once the specs have been updated, or bugs fixed in Ruby 1.9, the tags can be removed.
$ mspec tag --del fails core/array/append_spec.rb
When removing tags, it is usually best to give the specific file to process.
Runner script help
To see more help for the particular runner scripts:
$ mspec run -h $ mspec ci -h $ mspec tag -h
