[rspec-devel] rspec extensions

Ian Dees undees at gmail.com
Sun Sep 16 14:01:17 EDT 2007

Hi, all.  Quoth Brian:

> I think such a tagging feature would be useful in rspec core. To add
> it to rspec core (trunk), I think the following objects need to be
> touched (without seeing the code):
> * Tagging object(s)
> * Example.suite
> * ExampleApi (describe, it, and tags methods)
> * ExampleDefinition (tags method)
> * Options (For non-rake command line arguments)
> * OptionParser (For non-rake command line arguments)
> * maybe SpecTask

This to-do list sounds similar to the objects we had to modify or at
least study for a similar project at work.  We've hacked a
tagging-like option by using custom formatters that take parameters,
something like:

spec --format tag:foo --format tag:bar baz_spec.rb

I think we mainly had to mess around with the parser because we're
calling RSpec from our own command-line tool.

We use it for batch vs. interactive tests (a couple of our tests
require physically connecting a calibration cable or grabbing a
printout from the printer), and we want to use it for English vs.
non-language-specific tests.

We could get rid of all our custom formatter cruft (and option parsing
cruft) if we had tags.  Our code is a little baroque now.  (If I had
it all to do over again, I would've used the -r option and just had my
setup in different .rb files.)  But with every release of RSpec, I
seem to be able to cut a few more kludges from my stuff -- the trend
is definitely going in the right direction.

How would a tags mechanism be different from the behaviour_type option
that Aslak mentioned?  Is there documentation on behaviour_type?  I
see a few examples of how to attach it to a "describe" block, but not
much on what to do with it after that.


More information about the rspec-devel mailing list