[rspec-users] Extra Options to Heckle
mailing_lists at railsnewbie.com
Sun Aug 19 04:25:21 EDT 2007
On Aug 19, 2007, at 2:52 AM, Robert Feldt wrote:
> > One alternative I thought of is to have a standard way to "promote"
> > options to other tools that spec invokes. Along the lines of:
> > spec --heckle --options-heckle "--verbose --branches
> > MyModule::MyClass#my_method" ...
> > and the argument to --options-heckle (or --options-rcov etc) would
> > simply be passed along in the call to heckle. This would cover more
> > situations with a single solution.
> I've cooked up a patch for a tiny-little recursive parser in the
> command line parsing to deal with the promotion of options, so that
> you could do something like this:
> spec --heckle "MyClass --verbose --timeout 10"
> So far only the --verbose and --timeout options are used (and I'm not
> sure that they are even working yet, since I haven't used heckle on
> anything but an rspec project).
> I haven't worked more on the patch because I figured it would get
> rejected for the added complexity in command line parsing of
> Robert: Maybe if you would like to take a look at my changes, I could
> email you what I have so far, and we could divide up work on the rest
> of the heckle options. So far I have two, and there are only 8 or
> so, and at this point most of them look pretty trivial to implement.
> But why do you need to parse the contents of the string with the
> options that should be passed onto heckle? The idea is that it
> should simply be passed on. I'm probably missing something... ;)
Well - parsing in two regards:
1. On the command line, so that Ruby's OptionParser doesn't think
that a "--verbose" is a command to rspec. This alone isn't really an
issue until you factor in spec.opts, which is read in as a string (so
some detection of escaping must occur).
2. So that it can be used by the RSpec wrapper to Heckle. Heckle has
a base Heckle class, as well as a TestUnitHeckler class, which
descends from the Heckle class. All Hecker's (the command you run,
not the class) option parser does is set some default class variables
in the two classes (Heckle & TestUnitHeckler), so some of those class
level setters would need to be changed, anyway. This would probably
be clearer just by looking at the code for heckle + the relevant code
More information about the rspec-users