On Aug 1, 2010, at 5:39 PM, Myron Marston wrote: >> 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: > > http://github.com/myronmarston/rspec-core/commit/c353badcb8154ab98a7dc46eb19c8a9fc702ec73
If we do this, we should use module_exec for both blocks so they both get the same arguments. > > 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 > available: > > http://github.com/aslakhellesoy/cucumber/blob/30d43767a7cffd1675e990115ac86c139e4ea3e0/lib/cucumber/core_ext/instance_exec.rb#L16-31 RSpec does that too :). Pretty sure it was Aslak that added that some years back. Yeah - I'm playing around with an implementation of module_exec, but it doesn't seem to work quite the same way as instance exec does. Not yet, anyhow. David > > Myron > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users