Kerry Buckley

What’s the simplest thing that could possibly go wrong?

Unimplemented specs in RSpec


One of RSpec‘s many neat features is the ability to insert placeholder specs. These allow you to list a whole bunch of expected behaviour up front, without having to implement either the specs or the code, and without creating a huge swath of failing specs. All you need to do is omit the body of the specify or it block. Here’s a trivial example:

describe “The string ‘foo’” do
before do
@foo = ‘foo’

it “should be three characters long” do
@foo.size.should == 3

it “should be capitalised to ‘Foo’”

$ spec -f s foo_spec.rb                     

The string 'foo'
- should be three characters long
- should be capitalised to 'Foo' (NOT IMPLEMENTED)

Finished in 0.011201 seconds

2 examples, 0 failures, 1 not implemented

Technorati Tags: ,

Written by Kerry

July 29th, 2007 at 10:36 am

Posted in Ruby

2 Responses to 'Unimplemented specs in RSpec'

Subscribe to comments with RSS or TrackBack to 'Unimplemented specs in RSpec'.

  1. How To Update Facebook, Twitter, and Kopete’s Status All At Once…

    Ben Kudria

    16 Aug 07 at 8:01 pm

  2. looks like you can also do

    it “should do something” do
    pending “an announcement”


    it “should do something” do
    pending “an announcement” do


    15 Dec 09 at 5:06 pm

Leave a Reply