[rspec-users] somewhat confused by the help instructions...

Matt Wynne matt at mattwynne.net
Sat Jan 30 08:31:20 EST 2010


On 30 Jan 2010, at 06:45, David Chelimsky wrote:

> On Thu, Jan 28, 2010 at 12:54 PM, rogerdpack  
> <rogerpack2005 at gmail.com> wrote:
>> As a note of feedback, when I do a spec --help, I saw this line...
>>
>>    -e, --example [NAME|FILE_NAME]   Execute example(s) with matching
>> name(s). If the argument is
>>                                     the path to an existing file
>> (typically generated by a previous
>>                                     run using --format
>> failing_examples:file.txt), then the examples
>>                                     on each line of that file will be
>> executed. If the file is empty,
>>                                     all examples will be run (as if  
>> --
>> example was not specified).
>>
>> so I, trying to be clever, passed it something to match:
>>
>> E:\dev\ruby\spork>spec spec/spork/run_strategy/single* -e"the result"
>>
>>
>> Finished in 0.125 seconds
>>
>> 0 examples, 0 failures
>>
>>
>> Passing it the full test name seems to work, however:
>>
>> E:\dev\ruby\spork>spec spec/spork/run_strategy/single* -e"returns the
>> result of the run_tests method from the forked child"
>> ...
>>
>> Finished in 0.34375 seconds
>>
>> 3 examples, 0 failures
>>
>>
>> Suggestion:
>>
>> rephrase the help as "runs the test whose name equals the one
>> specified" (instead of using the word "matches" which to me somehow
>> meant "regex"), or
>>
>> change the matching to be regex matching (this one is what I would
>> personally prefer--then you don't have to put full test names on the
>> command line).
>>
>> Thoughts?
>
> Actually, I'm thinking of not supporting this in rspec-2. I personally
> find the line number much more useful, since you can just copy it
> directly from the failure messages to re-run something:
>
> spec path/to/spec.rb:37

This is great except when you use macros or other tricks to generate  
examples - then there isn't a 1:1: mapping from line number to  
example. I often find it quite annoying to have to quote the whole  
example description, so I actually quite like Roger's idea about using  
regexp matching.

> WDYT?
>
>> -r
>>
>> _______________________________________________
>> rspec-users mailing list
>> rspec-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
>>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

cheers,
Matt

http://mattwynne.net
+447974 430184



More information about the rspec-users mailing list