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.
Fundamentals
- In the last chapter, we learned the basic syntax of RSpec. In this chapter, we're going to learn to work with expectations. This is the heart of learning RSpec. You'll want to make sure that you cover all the material in this chapter and that you have a good understanding of it before you move on. In general, you want to try and have just one expectation for each of your examples. It is possible to have more than one and you will see people violate that from time to time, I certainly do, but the reason why you want to have one per example is because if you have more than one, then you're only going to see the first failure. So lets say you have 10 expectations in an example if the first one fails, it will never execute the other nine and you'll never find out if there was a problem with them. If we put them each in separate examples, each example runs independently and we would find out about all 10 problems in our code so that we could address them. So keep that in mind. I'm not…
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)
Fundamentals3m 48s
-
(Locked)
A deprecated modifier: should4m 19s
-
Equivalence matchers7m 3s
-
(Locked)
Truthiness matchers5m 41s
-
(Locked)
Numeric comparison matchers3m 32s
-
(Locked)
Collections6m 13s
-
(Locked)
Other useful matchers7m 44s
-
(Locked)
Predicate matchers5m 14s
-
(Locked)
Observation matchers10m 36s
-
(Locked)
Complex expectations10m 43s
-
(Locked)
-
-
-
-
-
-
-