Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

RSpec 2.0 Released: Ruby’s Leading BDD Framework Grows Up

By Peter Cooper / October 10, 2010

9 months in the making comes RSpec 2.0, the latest major version of Ruby's most popular behavior driven development (BDD) framework (now at a gem install rspec near you). Kudos to the 82 contributors and RSpec's team lead, David Chelimsky.

What has RSpec 2.0 got that RSpec 1.x doesn't?

  • Modularity. RSpec has been split up into multiple gems each with a particular focus like mocks, core, and "expectations." The theory behind this is that you could pick and choose parts from other frameworks, though I suspect most users will not benefit from this.
  • Totally new runner. RSpec 2.0 has borrowed heavily from the Micronaut, a BDD framework that adds more metadata and more structure to test suites. Taking on Micronaut's ideas makes RSpec significantly more flexible and open to manipulation and we're bound to see a lot of blog posts in the next few months about how to take advantage of this. One immediate benefit is "filters" which lets you run different tests under different circumstances, such as for different Ruby versions or implementations.
  • Better Rails 3 integration. RSpec 2.0 was originally intended to release before Rails 3.0 but now that Rails 3.0 has been in the wild a while, RSpec's integration with it is top notch.

If you want to learn more and dig around, it's worth seeing RSpec's GitHub page and then following the links to the components that take your interest.

If you're a hardcore RSpec 1.x user and want to know the changes behind the scenes and how best to upgrade, check out the RSpec 2.0 upgrade documentation.

Comments

  1. Chuck says:

    re modularity, I can think of situations where mocks could be very handy outside of specs. Cool.

Other Posts to Enjoy

Twitter Mentions