This repo is a step by step example to learn how to create Chef cookbooks by testing first.
I'll try to follow the BDD/TDD approach and try the different tools from the Chef's ecosystem such Test-Kitchen, ChefSpec, ServerSpec, Foodcritic...
I won't try to describe the right way, just what makes more sense to me based in my own experience. It'll serve me to learn the tools, to proof some ideas and to have some examples. Also to have documented problem I'll run into and the solutions I'll find. I hope this help someone else.
NOTE: This repo and this document are WIP, it's not finished and you'll miss some final steps (by now).
The process will be:
- Setup the minimal environment for testing how the new system should behave
- Create the minimal tests to check if the system behave as I wish
- Check that the tests doesn't pass
- Think about the simplest technical way to pass those tests
- Setup the minimal environment for testing this technical approach
- Create the minimal tests to check that minimal technical approach
- Check that the tests doesn't pass
- Create the minimal recipe to pass the technical tests
- Check that the tests do pass the technical tests
- Check that the tests do pass the behavior tests
Once I have this, I will think in another system behavior and repeat the process.
As example I will use the following example:
"I'd like to access with my browser to the system and read the sentence 'Hello world!' in my browser"
Pretty simple and common, isn't it?
I'll call the project webtest and I'll create a directory for every step I'll take. Something like this:
|-webtest-0
|-webtest-1
|-webtest-2
|-...
`-webtest-X
Each directory should be self-explanatory with its own README
file to explain what is the goal for that step, the dependencies, processes and difficulties found in that step.
See the current ones: