InfoQ

News

RSpec 1.1 - A Step Up for BDD advocates

Posted by Rick DeNatale on Dec 17, 2007 04:00 PM

Community
Ruby
Topics
Delivering Quality,
Agile Techniques,
Ruby on Rails
Tags
Rails,
RBehave,
RSpec,
BDD,
TDD
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?

No comments

Reply

Exclusive Content

Rationalizing the Presentation Tier

Thin client paradigm characterized by web applications is a kludge that needs to be repudiated. Old compromises are no longer needed and it's time to move the presentation tier to where it belongs.

Agile Project Management: Lessons Learned at Google

In this presentation filmed during QCon 2007, Jeff Sutherland, the creator of Scrum, talks about his visit at Google to do an analysis of Google's first implementation of Scrum.

AtomServer – The Power of Publishing for Data Distribution

In this article, Bryon Jacob and Chris Berry introduce AtomServer, their implementation of a full-fledged Atom Store based on Apache Abdera, which is now available as open source.

An Introduction to Virtualization

It is easy to think that virtualization applies only to servers. In reality the recent resurgence of the concept is also being applied to networking, storage, and application infrastructure.

REST Anti-Patterns

In this article, Stefan Tilkov explains some of the most common anti-patterns found in applications that claim to follow a "RESTful" design and suggests ways to avoid them.

Choosing between Routing and Orchestration in an ESB

In this article, Adrien Louis and Marc Dutoo discuss the differences and relative merits of using orchestration vs. routing in a typical ESB setup, and discuss various implementation options.

Enterprise Batch Processing with Spring

Wayne Lund discusses batch processing, Spring Batch objectives and features, scenarios for usage, Spring Batch architecture, scaling, example code, failures and retrying, and the future roadmap.

User Story Estimation Techniques

Developer Jay Fields draws on his experiences as a ThoughtWorks consultant to describe effective user story estimation techniques.