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.
Challenge: Guide - Ruby Tutorial
From the course: Ruby: Testing with RSpec
Challenge: Guide
- We’re ready for our fourth and final challenge: Writing specs for the Guide class. This is gonna be the most complicated of the four challenges. Mostly because we’re gonna be doing input and output on the command line. But don’t worry, I have some techniques that can help you out. In this challenge we’re gonna be seeing a couple more of the concepts that we’ve seen during this tutorial. We have “before(:example).” We’re gonna be using a true mock object using “double,” and “allow” will allow us to stub behaviors. We’re gonna be spying on a partial test double. You’ll see that we’ve used “skip” in place of ‘pending.’ And because we’re gonna be working with command line, we’ll be using our matcher for “output().to_stdout.” And there are also gonna be two helper methods that are gonna help you out: “setup_fake_input,” and “capture_output.” Altogether there are 14 pending examples, and I think they’ll take you approximately 45 minutes to an hour. Let’s begin by looking at those custom…
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.
Contents
-
-
-
-
-
-
-
-
-
(Locked)
Food-finder application6m 8s
-
(Locked)
Challenge: NumberHelper5m 49s
-
(Locked)
Solution: NumberHelper3m 8s
-
(Locked)
Challenge: StringExtend2m 6s
-
(Locked)
Solution: StringExtend3m 48s
-
(Locked)
Challenge: Restaurant5m 25s
-
(Locked)
Solution: Restaurant6m 30s
-
(Locked)
Challenge: Guide12m 49s
-
(Locked)
Solution: Guide6m 41s
-
(Locked)
-
-
-
-