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

RSpec and Behavior-Driven Development

RSpec bills itself as a behavior-driven development (BDD) test framework. We’d like to take a moment to talk about our use of that term, along with a related term, test-driven development (TDD).

Without TDD, you might check your program’s behavior by running it manually or by writing a one-off test harness. In situations where you intend to scrap the program shortly afterward, these approaches are all right. But when long-term maintenance is a priority, TDD provides important benefits.

With TDD, you write each test case just before implementing the next bit of behavior. When you have well-written tests, you wind up with more maintainable code. You can make changes with the confidence that your test suite ...

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