diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 0bbcec21b..e01833367 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -31,3 +31,6 @@ cookbooks to supermarkets. The cookbook generator now adds a LICENSE file when creating a new cookbook. + +## Boilerplate tests are generated for the CentOS platform +When `chef generate cookbook` is ran, boilerplate unit tests for the CentOS 7 platform are now generated as well. diff --git a/lib/chef-dk/skeletons/code_generator/templates/default/recipe_spec.rb.erb b/lib/chef-dk/skeletons/code_generator/templates/default/recipe_spec.rb.erb index 74811b0ee..2f17593e8 100644 --- a/lib/chef-dk/skeletons/code_generator/templates/default/recipe_spec.rb.erb +++ b/lib/chef-dk/skeletons/code_generator/templates/default/recipe_spec.rb.erb @@ -7,7 +7,7 @@ require 'spec_helper' describe '<%= cookbook_name %>::<%= recipe_name %>' do - context 'When all attributes are default, on an Ubuntu 16.04' do + context 'When all attributes are default, on Ubuntu 16.04' do let(:chef_run) do # for a complete list of available platforms and versions see: # https://github.com/customink/fauxhai/blob/master/PLATFORMS.md @@ -19,4 +19,17 @@ describe '<%= cookbook_name %>::<%= recipe_name %>' do expect { chef_run }.to_not raise_error end end + + context 'When all attributes are default, on CentOS 7.4.1708' do + let(:chef_run) do + # for a complete list of available platforms and versions see: + # https://github.com/customink/fauxhai/blob/master/PLATFORMS.md + runner = ChefSpec::ServerRunner.new(platform: 'centos', version: '7.4.1708') + runner.converge(described_recipe) + end + + it 'converges successfully' do + expect { chef_run }.to_not raise_error + end + end end