Skip to content

Instantly share code, notes, and snippets.

@gstark
Created June 11, 2010 21:02
Show Gist options
  • Select an option

  • Save gstark/435050 to your computer and use it in GitHub Desktop.

Select an option

Save gstark/435050 to your computer and use it in GitHub Desktop.
$ rvm use rbx
info: Using rbx 1.0.0 20100514
$ mspec
rubinius 1.0.0 (1.8.7 release 2010-05-14 JI) [x86_64-apple-darwin10.3.0]
mspec run [options] (FILE|DIRECTORY|GLOB)+
Ask yourself:
1. What specs to run?
2. How to modify the execution?
3. How to modify the guard behavior?
4. How to display the output?
5. What action to perform?
6. When to perform it?
What specs to run
-e, --example STR Run examples with descriptions matching STR
-E, --exclude STR Exclude examples with descriptions matching STR
-p, --pattern PATTERN Run examples with descriptions matching PATTERN
-P, --excl-pattern PATTERN Exclude examples with descriptions matching PATTERN
-g, --tag TAG Run examples with descriptions matching ones tagged with TAG
-G, --excl-tag TAG Exclude examples with descriptions matching ones tagged with TAG
-w, --profile FILE Run examples for methods listed in the profile FILE
-W, --excl-profile FILE Exclude examples for methods listed in the profile FILE
How to modify the execution
-C, --chdir DIR Change the working directory to DIR before running specs
--prefix STR Prepend STR when resolving spec file names
-B, --config FILE Load FILE containing configuration options
-n, --name RUBY_NAME Set the value of RUBY_NAME (used to determine the implementation)
-H, --random Randomize the list of spec files
-Z, --dry-run Invoke formatters and other actions, but don't execute the specs
--background Enable guard for specs that may hang in background processes
--int-spec Control-C interupts the current spec only
How to modify the guard behavior
--unguarded Turn off all guards
--no-ruby_bug Turn off the ruby_bug guard
--report-on GUARD Report specs guarded by GUARD
-O, --report Report guarded specs
-Y, --verify Verify that guarded specs pass and fail as expected
How to display their output
-f, --format FORMAT Formatter for reporting, where FORMAT is one of:
s, spec, specdoc SpecdocFormatter
h, html, HtmlFormatter
d, dot, dotted DottedFormatter
f, file FileFormatter
u, unit, unitdiff UnitdiffFormatter
m, summary SummaryFormatter
a, *, spin SpinnerFormatter
t, method MethodFormatter
y, yaml YamlFormatter
-o, --output FILE Write formatter output to FILE
-V, --verbose Output the name of each file processed
-m, --marker MARKER Output MARKER for each file processed
What action to perform
--spec-debug Invoke the debugger when a spec description matches (see -K, -S)
--spec-gdb Invoke Gdb when a spec description matches (see -K, -S)
When to perform it
-K, --action-tag TAG Spec descriptions marked with TAG will trigger the specified action
-S, --action-string STR Spec descriptions matching STR will trigger the specified action
Help!
-d, --debug Set MSpec debugging flag for more verbose output
-v, --version Show version
-h, --help Show this message
Custom options
No custom options registered
How might this work in the real world?
1. To simply run some specs
$ mspec path/to/the/specs
mspec path/to/the_file_spec.rb
2. To run specs tagged with 'fails'
$ mspec -g fails path/to/the_file_spec.rb
3. To start the debugger before the spec matching 'this crashes'
$ mspec --spec-debug -S 'this crashes' path/to/the_file_spec.rb
No files specified.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment