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

aslak hellesoy aslak.hellesoy at gmail.com
Thu Mar 12 18:05:34 EDT 2009

On Thu, Mar 12, 2009 at 10:50 PM, Bill Venners <bill at artima.com> 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

Very cool!

> 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"

I rarely use this, as I don't write a lot of specs up front.

> # 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

I find myself using #2 the most. I use it when I want to reduce noise diring
a refactoring that breaks a lot.

> # 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

I sometimes use this when I'm not sure why the example is failing, but don't
want to look into it right now.

> Which of these forms do you find the most useful in practice, and are
> there any that you think would be better left out?


> Thanks.
> Bill
> ----
> Bill Venners
> Artima, Inc.
> http://www.artima.com
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

Aslak (::)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090312/3ef1b87d/attachment-0001.html>

More information about the rspec-users mailing list