I don’t think you’d use one over the other.
As a relatively new Chef myself, I’ve found that there is a place for all three. FoodCritic is a linter. It catches common mistakes and makes you conform to the ChefStyle guide.
ChefSpec is for testing that your cookbook is saying that it’s doing something. ( https://sethvargo.com/unit-testing-chef-cookbooks/ ). IE - My cookbook says to install the package httpd on a RedHat system. You should spend some time on Seth’s blog - lots of good information there.
ServerSpec is, for me, the final test. It actually runs and tests the system to make sure that what I told my cookbook to do, actually works right on a system.
I run all these through TestKitchen and Guard ( This post is a little outdated but helped me out quite a bit: https://micgo.net/ ).
I’m sure other Chefs will have more substantial information ( or correct mine ).
From: Robert Freiberger email@example.com
Sent: Tuesday, March 03, 2015 1:09 PM
Subject: [chef] Chef development model for new cooks
I’m very new to Ruby and Chef, where I have created basic cookbooks and recipes using various resources. At work, I’m starting to add my cookbooks into production but they need to pass various testing.
From many Chef guides and books, I’m not understanding the full path of proper Chef development. I have started to learn about using berks, and bundle, but how should I use foodcritic over the other tools like ChefSpec and ServerSpec?
Any comments are greatly welcome!