ChefSpec Gotcha: Using render_file
When Deleting Files (2 mins read).
How to use render_file
with ChefSpec when you're deleting the file.
ChefSpec Gotcha: Using render_file
When Deleting Files (2 mins read).
How to use render_file
with ChefSpec when you're deleting the file.
Chef Attributes and default.rb
- it's in the name (3 mins read).
Why you should only be setting defaults in your Chef attributes, and moving heavy lifting elsewhere.
Using Fake Cookbooks for Writing ChefSpec Tests for your Custom Chef Resources (3 mins read).
A directory structure I've found quite useful for writing ChefSpec tests for custom resources, by creating a fake cookbook within the cookbook you're testing.
Chef 14 Upgrade: Custom Resource Properties are Silently Coerced to Hash
if they are a nil
(2 mins read).
Finding out that a nil
gets silently coerced to an empty Hash
if given to a custom resource's property of type Hash
.
Chef 14: ChefSpec Coverage Reporting Deprecation (1 mins read).
Noting the deprecation of using ChefSpec::Coverage.start!
when using Chef 14 and above.
Chef 14 Upgrade: Change in ValidationFailed
error messages when setting required
properties (2 mins read).
The updated error message returned by a Chef ValidationFailed
error, when you're specifying which properties are required
on a custom resource.
Test-Driven Chef Cookbook Development Using ChefSpec (and a sprinkling of InSpec) (38 mins read).
Using the example of deploying and running a Java JAR file as a way to show the lifecycle of a fully test-driven Chef cookbook.
Testing Chef's ruby_block
s with ChefSpec (3 mins read).
Testing implementation of a ruby_block
in ChefSpec, to ensure that the code executes as expected.
Chef 13 Upgrade: Lessons Learnt and Documented for Posterity (1 mins read).
Notes on the main problems encountered when upgrading from Chef 12 to Chef 13, both with ChefSpec and Rubocop.
Chef 13 Upgrade: Rubocop Changes for Testing render_file
with ChefSpec and a with_content
Block (1 mins read).
How to resolve the Parenthesize the param render_file
Rubocop error when upgrading your cookbook to Chef 13.
Chef 13 Upgrade: Testing ruby_block
s with ChefSpec (1 mins read).
Replace your block.old_run_action
with block.block.call
to trigger ruby_block
s within ChefSpec 7 and Chef 13.
Getting around Permission Denied
when running ChefSpec (3 mins read).
How to handle getting an EACCES
when trying to run ChefSpec on a recipe.
Testing include_recipe
s with Chef and ChefSpec (2 mins read).
How to best test include_recipe
s within your Chef recipes, as well as how to ensure that you aren't running any dependent recipes in your tests.