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: NumberHelper - Ruby Tutorial
From the course: Ruby: Testing with RSpec
Challenge: NumberHelper
- Your first challenge is to write the specs for the NumberHelper module. Let me start by giving you a few pointers. Whenever writing specs, I think it's a good idea to spend a few minutes thinking about what to test. When you look over the code, what parts of it need testing? It can be useful to think about the happy path or the path where everything goes exactly as you've planned, as well as the many possible unhappy paths where things go wrong. Or to think about some of the edge cases that you might encounter, where the possible even though less common events happen. For example, you may have code that works correctly when given an integer as an argument but does it still gracefully handle cases when the argument is a string, a float, nil or an array? Should it? It can also be helpful to consider basic usage versus advanced usage, that's gonna be the case with the NumberHelper. We can simply pass in a number as the only argument and get to default behavior or we can pass in options…
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)
-
-
-
-