Codementor Events

Why RSpec is so popular

Published Mar 23, 2019

I've used both for years. But I use RSpec on all my new projects:

RSpec is an application, but Minitest is only a library

Screen Shot 2019-03-23 at 12.59.49 AM.png

This cannot be overstated. RSpec has libraries too, of course, but the user experience is via a mature CLI program. (Bisect is wicked, and a life-saver!) It has incredibly useful options and features that are all described like you'd expect, via the --help option. But since Minitest is just a library, it needs something else to run it. Usually, that's Rake. Result: the user experience is nowhere near as good because Rake is just a simple task runner. Simple features like "run all tests" require custom Rake DSL coding. (!)

RSpec has incredible, auto-generated documentation

Screen Shot 2019-03-23 at 1.10.22 AM.png

Poke around in the straight-from-cucumber docs, and you'll be impressed with the readability. It's chock full of examples! In fact, every feature has an example because this is literate code. I've never found a Minitest resource that comes close. And personally, when I'm using a framework — Minitest or RSpec — that has its own unique DSL and practices, good docs are crucial.

RSpec has first-class spec syntax support

Screen Shot 2019-03-23 at 1.03.10 AM.png

It's the only syntax, and it's a pleasure to use. It's the lingua franca of testing: my Ruby tests look just like my Haskell tests. Now Minitest has a spec syntax option. And it's not supported as well as the standard minitest syntax. Minitest's spec docs are even more primitive than the standard docs. (Notice how they're not actually documented — they just link to the equivalent Minitest function. So you need to bounce back and forth, and learn the other syntax even if you don't use it.)

RSpec, out of the box, has all the features a working developer needs

Screen Shot 2019-03-23 at 1.05.09 AM.png

And so they're all core to the project, and all have first class support. Minitest advocates will say that there are plugins for any feature that RSpec has, and they're listed in the README. When I checked it, though, I found that list to be more of a graveyard than a shipyard. Many (most?) were old or broken. Finding the ones in good shape would be a new task for me. And then, of course, there's a risk that any of them can stop being maintained at any time.

Discover and read more posts from Robb Shecter
get started