[rspec-devel] Feedback on article

aslak hellesoy aslak.hellesoy at gmail.com
Tue Jan 2 11:29:45 EST 2007


On 1/2/07, Nick Sieger <nicksieger at gmail.com> wrote:
> Hi, I wrote an article [1] outlining some tricks I've developed adding
> custom extensions into RSpec.  But they all hinge upon
> Spec::Runner::Context#before_context_eval and the
> @context_eval_module ivar.  So I was wondering whether this mechanism can be
> relied on in the future, or whether this is even the best way to wire in
> such extensions.  If you have a recommended way I'd love to hear about it so
> I can incorporate it into my article and make sure I don't highlight the
> wrong way of doing things.
>

That's a great explenation of some of the hardest-to-understand
corners of RSpec. Thanks a lot for writing it! It's very pedagogic.

Regarding the stability of the API - I'm a little worried about having
extensions use private variables. I think it would be better to pass
the module to the method:

before_context_eval(context_eval_module)

A second point is monkey patching. I'm not convinced it's the best way
to do things - it makes things tricky when you want to tweak things
more than once (see my mail from yesterday - I want to mix the
screenshot stuff with fixtures).

I haven't thought of an alternative way yet, but I think we need to be
able to register "extension" blocks somehow.

Aslak

> Thanks and happy new year!
>
> /Nick
>
> [1]:
> http://blog.nicksieger.com/articles/2007/01/02/customizing-rspec
>
> _______________________________________________
> rspec-devel mailing list
> rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel
>
>


More information about the rspec-devel mailing list