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 &#8220;context&#8221; and &#8220;specify&#8221; weren&#8217;t speaking to him, so he wrapped them in &#8220;describe&#8221; and &#8220;it&#8221; to create the syntax in the example above.</p>


<p>These new words have been added to rspec&#8217;s trunk and will be released with rspec-0.8.3. Combined with their elder siblings &#8220;context&#8221; and &#8220;specify&#8221;, you&#8217;ll now be able to choose from a wider set of words to get your specs to &#8220;speak&#8221;.</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&#8217;s Story Runner with rspec describing lower level behaviours and you&#8217;ll have the beginnings of the perfect toolset for a <span class="caps">BDD</span> project in Ruby.</p>

2 Responses to “Describe it with RSpec”

  1. Dan Manges Says:

    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.

    <p>By the way, thank you for all the work you put into rpsec.</p>
    
  2. Dan North Says:

    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.

    <p>Great stuff!</p>