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

Fundamentals - Ruby Tutorial

From the course: Ruby: Testing with RSpec

Start my 1-month free trial

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…

Contents