Ruby RSpec or Minitest on new projects?

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

  • RSpec is an application, but Minitest is only a library. 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. 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. 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. Minitest, in contrast, 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. 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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s