On Wed, Jun 17, 2009 at 11:14 AM, Andrew Premdas<aprem...@gmail.com> wrote:
> What I'd like to do is create a shared_examples group which I can parametize
> a method. So my shared example would perhaps use method named_address=, or
> set_named_address and then groups that behave like "Named address" would be
> able to override this method so it sets the correct address e.g. the last
> billing address

This is horrendously ugly, but I was able to achieve something like
what you're talking about using a combination of instance variables
and 'eval' statements in the shared behavior.  See:

http://gist.github.com/131526

Readable and elegant?  Not really.  But I have to set up a crapload of
these classes layered on top of somebody else's SOAP API, and spec
completeness was more important to me than spec maintainability.

(Also, it didn't occur to me to try macros.)  >8->


-- 
Have Fun,
   Steve Eley (sfe...@gmail.com)
   ESCAPE POD - The Science Fiction Podcast Magazine
   http://www.escapepod.org
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to