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

What Your Specs Are Doing for You

Writing specs isn’t the goal of using RSpec—it’s the benefits those specs provide. Let’s talk about those benefits now; they’re not all as obvious as “specs catch bugs.”

Creating Confidence

Specs increase confidence in your project. We’re not talking about the simplistic view that if your specs pass, your program is bug-free (we’ve been programming in the real world for far too long to believe that fairy tale).

When we say confidence, we mean that a well-written spec can provide evidence in favor of certain claims about your code. For instance:

  • The “happy path” through a particular bit of code behaves the way you want it to.

  • A method detects and reacts to an error condition you’re anticipating.

  • That last feature ...

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