David Chelimsky

random thoughtlessness

Describe it with RSpec

module BddTools

describe RSpec do
  it "should help you get the words right" do
    Kernel.should respond_to(:describe)
    Behaviour.should respond_to(:it)

That code produces this output:

- should help you get the words right

Behaviour Driven Development is all about getting the words right.

Dan North has just registered rbehave at rubyforge and is using rspec to drive ITS behaviour. Getting started, he felt that “context” and “specify” weren’t speaking to him, so he wrapped them in “describe” and “it” to create the syntax in the example above.

These new words have been added to rspec’s trunk and will be released with rspec-0.8.3. Combined with their elder siblings “context” and “specify”, you’ll now be able to choose from a wider set of words to get your specs to “speak”.

Keep your eyes peeled for rbehave, an Acceptance Testing Framework that provides a Story Runner designed to promote communication between Customers, Developers and Testers. Combine rbehave’s Story Runner with rspec describing lower level behaviours and you’ll have the beginnings of the perfect toolset for a BDD project in Ruby.