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).

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

Ashley

--
http://www.patchspace.co.uk/
http://aviewfromafar.net/

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to