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

Sean Grove sean at saucelabs.com
Mon Dec 28 12:06:59 EST 2009

I'm writing a very simple spec dispatcher, but I want to do it on the  
level of examples. I'd like to be able to send individual examples to  
my clients, have it run and receive the result back. Currently I can  
send a file name and have the entire file run (thus distributing the  
rspec tasks at the file-level), but I'm trying to distribute each  
individual example out.

Thus if I can get a list of examples from a file along with their line  
number, I can put them in a queue and have clients pull them out one  
by one.

On Dec 28, 2009, at 8:59 AM, rspec-users-request at rubyforge.org wrote:

> Date: Mon, 28 Dec 2009 10:59:07 -0600
> From: David Chelimsky <dchelimsky at gmail.com>
> To: rspec-users <rspec-users at rubyforge.org>
> Subject: Re: [rspec-users] Listing all specs in a given file
> Message-ID:
> 	<57c63afe0912280859j61550cc3r84715416923091da at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
> On Mon, Dec 28, 2009 at 10:48 AM, Sean Grove <sean at saucelabs.com>  
> wrote:
>> 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
>> Spec::Runner::CommandLine.run(options)
>> 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?
> I'm not clear on what your goal is here. Can you give a little more  
> context?
> Why do you need a list of examples from a filename?
>> Thanks for all the help!
>> Sean
>> _______________________________________________
>> rspec-users mailing list
>> rspec-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20091228/e5c7265e/attachment.html>

More information about the rspec-users mailing list