We cover:

  • What kind of information RSpec stores about each spec
  • How you can tag your examples with custom information
  • How to perform expensive setup only when you need to
  • How to run just a subset of your specs

Chapter 8Slicing and Dicing Specs with Metadata

Over the course of this book, you’ve followed a key principle that has made your specs faster, more reliable, and easier to use: run just the code you need. This principle shows up in several practices you’ve been using as you’ve followed along with the code examples:

  • When you’re isolating a failure, run just the failing example.
  • When you’re modifying a class, run just its unit tests.
  • When you’ve got expensive setup code, only run it for the specs where you need it.

A key piece of RSpec that’s ...

Get Effective Testing with RSpec 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.