We cover:

  • How your specs can give you confidence in your code
  • How a good test suite makes refactoring possible
  • How to guide your design using your specs with behavior-driven development (BDD)

Chapter 3The RSpec Way

Over the last couple of chapters, you’ve gotten to know RSpec. You’ve written your first few examples and organized them into groups. You’ve seen how to run just a filtered subset of your specs and how to customize output.

All these features of RSpec are designed to make certain habits easy:

  • Writing examples that clearly spell out the expected behavior of the code
  • Separating common setup code from the actual test logic
  • Focusing on just what you need to do to make the next spec pass

None of these habits comes without a cost:

  • Writing ...

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.