[rspec-users] Listing all specs in a given file

Sean Grove sean at saucelabs.com
Mon Dec 28 11:48:04 EST 2009

I'm trying to write a simple spec dispatcher, the client-side of which  
essentially does the following:

options = Spec::Runner::OptionParser.parse( "#{file}", $stderr,  
std_out )
options.line_number = line

Given a spec file and a line number, it'll run the spec. Simple enough.

My problem is on the server side trying to pull out individual specs  
to be run out of a file/series of files. The above code works well if  
I pre-populate and array as follows:

queue = [["spec/one_spec.rb", 9],
          ["spec/one_spec.rb", 28],
          ["spec/one_spec.rb", 35]]

But I'm having a hard time figuring out how to pull out a list of  
examples given a spec filename. Is this parsed at some point before  
running, and can I get to that list easily enough?

Thanks for all the help!


More information about the rspec-users mailing list