Your Turn

In this chapter, you installed RSpec and took it for a test drive. You wrote a few simple specs to get a feel for the major parts of the framework. You saw how to run your examples and interpret the output. Finally, you explored a few different ways to reduce duplication in your specs.

Now, it’s time to put this knowledge to the test.

Exercises

  1. We’ve shown you three primary ways to reduce duplication in RSpec: hooks, helper methods, and let declarations. Which way did you like best for this example? Why? Can you think of situations where the others might be a better option?

  2. Run rspec --help and look at the available options. Try using a few of them to run your sandwich examples.

Ready to see some of our favorite ways to use RSpec? Take a quick sandwich break and then meet us in the next chapter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset