From the course: Ruby: Testing with RSpec

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Skipping examples and working with pending examples

Skipping examples and working with pending examples - Ruby Tutorial

From the course: Ruby: Testing with RSpec

Start my 1-month free trial

Skipping examples and working with pending examples

- In RSpec, it's also possible to skip over certain examples. We can do that by marking them as being pending, or by telling it that it ought to skip them. Let's see how we do that in this movie. There are two ways that we can mark something as being Pending. We can either simply Omit the block that comes after the description, for the example, or we can use they keyword pending inside the block. For Skipping, we can simply prefix either describe or it, with an x. Just putting an x in front of there will allow us to temporarily skip something. Or, we can use the keyword skip inside the block. Let's see how all of these work. If you recall, when we wrote our specs for the Car class, we did not yet provide an example for this attribute writer, :doors. We did it for :make, :year, :color, and :wheels, but not for :doors. So what I want to do now, is add a pending example for :doors to our spec file. I'm going to fold all of these up under attributes, and down here at the bottom, I'm going…

Contents