O'Reilly logo

Effective Testing with RSpec 3 by Myron Marston, Ian Dees

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Selecting Which Specs to Run

When you’re running your specs, you often want to change which ones you include. In this section, we’re going to show you a few different situations where this kind of slicing and dicing comes in handy.

Filtering

Most of the time when we start RSpec, we don’t run the entire suite. We’re either running unit specs for a specific class we’re designing or we’re kicking off some integration specs to catch regressions.

We first touched on running specific examples in Running Just What You Need. You saw how to select examples by pass/fail status, by our need to focus on them, and by custom tags. Let’s take a deeper dive into how to control which specs to run.

Excluding Examples

Sometimes, you want to exclude a set of examples ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required