[rspec-users] [rspec] loading specs as an object model without running them

Matt Wynne matt at mattwynne.net
Wed Apr 29 02:27:28 EDT 2009


On 29 Apr 2009, at 07:23, Marty Andrews wrote:

> I'd like to load all of my examples into memory without actually
> running them, so I can traverse the object tree and get descriptions
> etc.  I'm finding it tricky to figure out how to do that though.
> There seems to be an inherent assumption in the framework that that
> examples will actually run.
>
> So basically, I want to do something like this:
>
> examples = load_examples_without_running
> examples.each {|example| puts example.description}
>
> def load_examples_without_running
>  # what goes here?
> end
>
>
> Does anyone have an idea about how I might do that?

Use the dry-run option?

Matt Wynne
http://blog.mattwynne.net
http://www.songkick.com



More information about the rspec-users mailing list