[rspec-users] shared examples sharing methods

David Chelimsky dchelimsky at gmail.com
Wed Jun 17 14:28:00 EDT 2009


On Wed, Jun 17, 2009 at 1:19 PM, Matt Wynne<matt at mattwynne.net> wrote:
>
> On 17 Jun 2009, at 16:21, David Chelimsky wrote:
>
>> On Wed, Jun 17, 2009 at 10:14 AM, Andrew Premdas<apremdas at gmail.com>
>> wrote:
>>>
>>> Please have a look at
>>> http://gist.github.com/131277
>>> 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
>>
>> Here's the short version: There's been a lot of discussion on this
>> list about parameterizing shared examples. Basically, given the
>> current design it can't happen, and macros are a perfectly good
>> solution to the problem, so there's not much incentive to change the
>> design.
>
> You can use instance variables to pass values to the shared examples,
> though, right?

At your own risk, yes, of course :)

>
> cheers,
> Matt Wynne
>
> http://mattwynne.net
> +447974 430184
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list