Describe it with RSpec
March 10th, 2007
module BddTools
describe RSpec do
it "should help you get the words right" do
Kernel.should respond_to(:describe)
Behaviour.should respond_to(:it)
end
end
end
That code produces this output:
BddTools::RSpec
- 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.


July 13th, 2008 at 06:06 AM
I really like rspec and am looking forward to rbehave. When I first heard of rbehave I thought it was going to be yet another BDD library for Ruby, but I like the idea of rbehave for acceptance testing and rspec for lower level behaviors.
By the way, thank you for all the work you put into rpsec.
July 13th, 2008 at 06:06 AM
I’ve been using rspec for only a few days now in anger, and I’m really liking it. It’s very “obvious”, which is a Good Thing, and with the tiny amount of syntactic sugar I’ve changed, I’m finding it very expressive for what I’m trying to do.
Great stuff!