[rspec-users] How do you use pending in RSpec?

Scott Taylor scott at railsnewbie.com
Thu Mar 12 18:02:31 EDT 2009

On Mar 12, 2009, at 5:50 PM, Bill Venners wrote:

> Hi All,
> I've been working on BDD support in a test framework for Scala
> imaginatively called ScalaTest, and I want to add support for the
> notion of pending examples. I see three different "forms" of pending
> in RSpec, and I'm curious to hear which ones RSpec users find most
> useful. The three forms are:
> # 1. With no block you get a PENDING (Not Yet Implemented) in the  
> report
> it "should say foo"
> # 2. Passing a string, but no block, to pending. You get the PENDING
> (get the vocal chords working) in the report.
> it "should say foo" do
>  pending("get the vocal chords working")
>  subject.should say("foo")
> end
> # 3. Pass a string and a block to pending. If the pending code raises
> an exception, then you get PENDING (get the vocal chords working)k
> # but if not, I believe the whole tests fails to let you know you need
> to drop the pending stuff now that it works (I may be wrong).
> it "should say foo" do
>  pending("get the vocal chords working") do
>    subject.should say("foo")
>  end
> end
> Which of these forms do you find the most useful in practice, and are
> there any that you think would be better left out?

Don't forget xit(), either, which doesn't run a group of tests.

pending with a string is what I use most often, but pending with a  
block (with or without a string) is immensely helpful when refactoring.


More information about the rspec-users mailing list