[rspec-users] Conditionally turning some specs on and off depending on runtime platform
Wincent Colaiuta
win at wincent.com
Fri Sep 26 08:13:02 EDT 2008
El 26/9/2008, a las 13:30, Ashley Moran
<ashley.moran at patchspace.co.uk> escribió:
> On Sep 25, 2008, at 9:50 pm, Wincent Colaiuta 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?
>>
>> describe 'Something' do
>> before do
>> if required_tools_not_installed
>> pending 'not running on this platform'
>> end
>> end
>>
>> it 'should do something' do
>> 1.should == 1
>> end
>> end
>
> Hi Wincent
>
> How about wrapping it this way instead...
>
> describe 'Something' do
> if required_tools_installed
> it 'should do something' do
> 1.should == 1
> end
> end
> end
>
> That will make them invisible (for better or worse).
Yeah, that's another way of doing it.
> How come you need this? Is what you really need to spec that the tool
> itself degrades gracefully? eg
>
> describe 'Something' do
> if required_tools_installed
> it 'should do something' do
> 1.should == 1
> end
> else
> it 'should inform the user the tool is missing'
> end
> end
No, it's actually a case of having a bunch of Java junk installed on
my local system which I can use to do extended testing of things like
feed validity on this machine, while on the server I don't have (and
can't install) the Java stuff so would like to skip those specs.
Cheers,
Wincent
More information about the rspec-users
mailing list