Class MSpecScript
In: lib/mspec/utils/script.rb
Parent: Object

MSpecScript provides a skeleton for all the MSpec runner scripts.

Methods

config   config   custom_options   custom_register   entries   files   get   load   load_default   main   new   register   set   signals  

Public Class methods

Returns the config object. Maintained at the class level to easily enable simple config files. See the class method set.

Gets the value of key from the config object. Simplifies getting values in a config file:

  class MSpecScript
    set :a, 1
    set :b, 2
    set :c, get(:a) + get(:b)
  end

Instantiates an instance and calls the series of methods to invoke the script.

Associates value with key in the config object. Enables simple config files of the form:

  class MSpecScript
    set :target, "ruby"
    set :files, ["one_spec.rb", "two_spec.rb"]
  end

Public Instance methods

Returns the config object maintained by the instance‘s class. See the class methods set and config.

Callback for enabling custom options. This version is a no-op. Provide an implementation specific version in a config file. Called by options after the MSpec-provided options are added.

Callback for enabling custom actions, etc. This version is a no-op. Provide an implementation specific version in a config file. Called by register.

Attempts to resolve partial as a file or directory name in the following order:

  1. +partial+
  2. +partial+ + "_spec.rb"
  3. <tt>File.join(config[:prefix], partial)</tt>
  4. <tt>File.join(config[:prefix], partial + "_spec.rb")</tt>

If it is a file name, returns the name as an entry in an array. If it is a directory, returns all *_spec.rb files in the directory and subdirectories.

If unable to resolve partial, returns Dir[partial].

Resolves each entry in list to a set of files.

If the entry has a leading ’^’ character, the list of files is subtracted from the list of files accumulated to that point.

If the entry has a leading ’:’ character, the corresponding key is looked up in the config object and the entries in the value retrieved are processed through entries.

Returns true if the file was located in +config[:path]+, possibly appending +config[:config_ext]. Returns false otherwise.

Attempts to load a default config file. First tries to load ‘default.mspec’. If that fails, attempts to load a config file name constructed from the value of RUBY_ENGINE and the first two numbers in RUBY_VERSION. For example, on MRI 1.8.6, the file name would be ‘ruby.1.8.mspec’.

Registers all filters and actions.

Sets up signal handlers. Only a handler for SIGINT is registered currently.

[Validate]