[rspec-users] Conditionally turning some specs on and off depending on runtime platform

Wincent Colaiuta win at wincent.com
Fri Sep 26 10:31:03 EDT 2008


El 26/9/2008, a las 16:16, "David Chelimsky" <dchelimsky at gmail.com>  
escribió:

> On Fri, Sep 26, 2008 at 8:42 AM, Wincent Colaiuta <win at wincent.com>  
> wrote:
>> El 26/9/2008, a las 14:59, "David Chelimsky" <dchelimsky at gmail.com>
>> escribió:
>>
>>> On Thu, Sep 25, 2008 at 3:50 PM, Wincent Colaiuta  
>>> <win at wincent.com> wrote:
>>>>
>>>> The following trick, calling "pending" from inside the before  
>>>> block,
>>>> effectively does what I want. But I'm wondering if I can count on  
>>>> this
>>>> behaviour going forward? What do you think?
>>>
>>> Pending is not going anywhere.
>>
>> I didn't think so... I was mostly concerned about the fact that I am
>> (ab)using it by calling it from inside the "before" block...
>
> That doesn't strike me as abuse :)

Glad to hear you think so!

The truth is, sticking the check in the "before" block "feels" right,  
at least to me, because asking "can I run this example?" is something  
that I (obviously) want to do _before_ running each example. Bonus is  
that the examples in question print out the pending message rather  
than just disappearing into the nether.

In contrast, nesting all the affected examples inside a large "if"  
feels much nastier.

Cheers,
Wincent



More information about the rspec-users mailing list