O'Reilly logo

Chef Infrastructure Automation Cookbook by Matthias Marschall

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Test Driven Development for cookbooks using ChefSpec

Test Driven Development (TDD) is a way to write unit tests before writing any recipe code. By writing the test first, you design what your recipe should do and you ensure that your test is for real because it should fail as long as you haven't written your recipe code.

As soon as you've done your recipe, your unit tests should pass.

ChefSpec is built on the popular RSpec framework and offers a tailored syntax for testing Chef recipes.

Let's develop a very simple recipe using the TDD approach with ChefSpec.

Getting started...

Make sure you've a cookbook called my_cookbook and the run_list of your node includes my_cookbook as described in the Creating and using cookbooks section in Chapter 1, Chef ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required