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

RSpec 2.8: The Popular Ruby BDD Tool Goes Supersonic

By Peter Cooper / January 7, 2012

RSpec 2.8 has been released, along with rspec-rails 2.8.1 for the full Rails 3.x integration experience.

RSpec is a BDD-focused testing tool that's particularly popular in the Rails world where everyone except DHH is using it (if you believe the hoopla). RSpec has faced accusations of being less than speedy in the past, but it seems 2.8 has had a performance firework shoved up its tailpipe:

David Chelimsky, the creator of RSpec, also notes that in RSpec 2.8:

  • the documentation has been significantly improved
  • there's improved support for tags and filtering
  • random example running order support (with user definable seed)
  • rspec --init will create a spec directory and some starter code on a blank project - ideal for Ruby library development!

Overall, 2.8 seems like a good step forward, and if you've been feeling a little constipated in the spec running department lately, RSpec 2.8 might help you get things flowing again (though as with Ruby 1.9 vs 1.8, your mileage may vary depending on your usage.)


  1. Jonathon says:

    I've been using minitest/spec for a while without much problem. Is there a reason for rspec's popularity besides the fact it has automagical integration with rails?

  2. Peter Cooper says:

    It's been around longer, includes a mature mocking and stubbing system (a common complaint I've seen from minitest/spec newbies), has a better reporting and output system, among other things.

  3. foomatic says:

    Also there's a book for RSpec (which is actually quite good). In my experience (yours may differ) most Ruby developers use RSpec so it is quite easy to get help, exchange views etc.

    It's a great project overall, well done for the 2.8 release.

  4. John-Paul Bader says:

    Just for the record: I don't use rspec either, nor any other magic, fancy, bloated test framework suite. I'm with dhh here. test/unit or minitest do the job just fine.

  5. chrismealy says:

    I get exactly the same speed at rspec 2.6.0.

  6. Andrew Grimm says:

    I don't use RSpec, pretty much for the reason janfri gave in the DHH post, but why has its performance improved? I assumed that load times are (or at least were until recently) the main bottleneck in any testing framework.

  7. Cain says:

    @Andrew Grimm, the RSpec team reimplemented all the DSL matchers to use classes. Check out the benchmark here to see the speed differences:

  8. patrick says:

    agreeing with chrismealy, same results as 2.6.0. i never updated to 2.7.0 because it ran so slow (~60% increase)

  9. Vito Botta says:

    When I read this I was jumping to upgrade hoping to speed up an app's test suite but.. ouch, I had already upgraded :(

Other Posts to Enjoy

Twitter Mentions