BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

RSpec 1.1 - A Step Up for BDD advocates

| by Rick DeNatale on Dec 17, 2007. Estimated reading time: 1 minute |
A number of important releases have come out in the Ruby community recently. On December 7, we saw the release of Rails 2.0. Now, David Chelimsky has announced the release of RSpec 1.1.

This new release works nicely with Rails 2.0. The RSpec trunk has been tracking EdgeRails (the development version of Rails, i.e. the one that hasn't been released yet), and developers who are on both EdgeRails and the RSpec trunk have been helping the RSpec team work out the differences. This is one motivation for the release, but there are some other attractions.

One major new addition to the RSpec arsenal is a story runner. Stories come from Dan North's rbehave tool which has been merged into RSpec. Stories are executable statements of application requirements. For Rails users, RSpec 1.1.0 also includes RailsStory. This fills the role of "traditional" Rails integration testing, using Test:Unit, as well as having other uses such as acceptance tests.

One of the disincentives of using RSpec for existing Rails projects which already use Test::Unit is how to make the transition. RSpec now makes this easy. The RSpec runner for Rails has actually been built on top of Test::Unit for over a year. RSpec 1.1.0 introduces a Spec module which can be included in Test::Unit TestCases along with Test::Unit. Once you've done that, you can gradually change from Test::Unit to Rspec syntax. TestCases can be changed gradually to example groups; tests to examples; and assertions to expectations. This allows you to metamorphose your existing TestCases, keeping them working as you go.

Another major new feature is the ability to nest example groups. This makes for more natural sub-specifications, which are variations of more general specifications. in many cases than using the existing shared specification feature of RSpec.
All in all, this is big news for both current and prospective RSpec users.

Are you using RSpec? If not, why not?

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and dont miss out on content that matters to you

BT