From the course: Ruby: Testing with RSpec
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
What are test doubles? - Ruby Tutorial
From the course: Ruby: Testing with RSpec
What are test doubles?
- In this chapter, we'll learn how to use test doubles in RSpec. We're going to begin by getting an understanding of what test doubles are. Test doubles are an object that we use during testing that stands in for another object. It's similar to a stand-in or a body double or a stunt double for an actor or actress. A stand-in is a person who substitutes for the actor or actress before filming. Often they stand in the right place to allow the lighting team to set everything up, and that can be a slow process. Or the director might ask stand-ins to run through the scene that's to be filmed. The idea is that they don't need the actual actor or actress during the setup and run-through, but they need someone who can serve as a placeholder, someone who looks similar or at least has the same height and build. The stand-in can perform basic functions as well as the star talent could. We don't need the real thing all the time, and that's what test doubles are gonna do for us. We don't always…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.