Describe it with RSpec
March 11th, 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.
<p><a href="http://dannorth.net">Dan North</a> has just registered <a href="http://rbehave.rubyforge.org">rbehave</a> at <a href="http://rubyforge.org">rubyforge</a> and is using <a href="http://rspec.rubyforge.org">rspec</a> to drive <span class="caps">ITS</span> 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.</p>
<p>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”.</p>
<p>Keep your eyes peeled for <a href="http://rbehave.rubyforge.org">rbehave</a>, 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 <span class="caps">BDD</span> project in Ruby.</p>



March 11th, 2007 at 12:07 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.
March 11th, 2007 at 12:07 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.