[rspec-users] Evaluating shared example customisation block before shared block

Myron Marston myron.marston at gmail.com
Sun Aug 1 18:39:02 EDT 2010

> Seems like your mental model is that of a customization block being a subclass or re-opening of the shared block. What you say makes sense in that model, but that's not the same model I have.

My mental model is indeed that the customization block is like a
subclass.  I'm not sure where I got it--it's just the intuitive way I
understood shared_examples_for and it_should_behave_like.  But if no
one else shares this mental model, then there's not much point in
making rspec work this way.  I'm happy going with whatever the general
consensus is.  Although, I do think that my mental model makes for
some interesting possibilities :).

> Assuming that can work. I've taken a closer look and getting that to work would take some serious re-architecting that I'm not sure is a good idea.

Maybe I misunderstood you here, but I took this to refer to the
passing of parameters to the shared example group, as you
suggested...and it turns out this isn't very hard at all:


The one issue with this is that it uses #module_exec, which is not
available in ruby 1.8.6--so we'd have to find a way to implement it,
similar to how cucumber implements #instance_exec when it's not



More information about the rspec-users mailing list