Chapter 10. Odds and Ends

In this chapter, we will finish our journey through RSpec by learning about a few miscellaneous topics which are important but which didn't quite fit into the flow of the preceding chapters, which focused on a smooth progression through RSpec's essential features.

Here is what we will cover in this chapter:

  • Reducing duplication with shared example groups
  • Mocking time
  • Detecting false negatives and false positives
  • Testing mixins with dummy containers

Reducing duplication with shared example groups

Often, similar assertions are made in multiple tests, which leads to duplication of code. One of the ways this can be addressed is with RSpec's shared example groups, which allow you to reuse a set of tests to fit different situations. ...

Get RSpec Essentials 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.