[rspec-users] Example vs ExampleProxy

David Chelimsky dchelimsky at gmail.com
Sun Dec 13 22:59:14 EST 2009


On Sun, Dec 13, 2009 at 2:58 PM, Sean Grove <sean at saucelabs.com> wrote:
> Hey all,
>
> I'm working on bring DeepTest up to compatibility with rspec 1.2.9 in order
> to parallelize tests, and hit a few roadblocks after 1.1.12. Specifically, I
> was wondering about ExampleProxy (which I know now is for the custom
> formatter) vs Example.

Any formatter - builtin or custom.

> Previously I would call run() on an Example, but
> that's no longer a method on the ExampleProxy objects - is there a way to
> grab the Example object from an ExampleProxy, or am I going about this the
> wrong way(TM)?

The proxies don't have refs back to the examples by design. Need to
find a means of accessing the examples directly, not their proxies.

Unfortunately, there is not really a good extension point for this
right now. I'll add one for the next release, but in the mean time
you'll need to replace line 30 in deep_test/spec/runner.rb with
something like this:

        examples = example_groups.map do |g|
          proxies = g.send(:examples_to_run)
          proxies.map {|p| g.new(p, &g.example_implementations[p])}
        end.flatten

That's untested, but should give you the basic idea. If this can wait
a bit, let's coordinate off list and work out a good extension point -
I'll do a release in the next week or so that exposes it and you can
follow up w/ your release. Good?

Cheers,
David

> Thanks for your help.
>
> Sean
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list