require 'support/integration_helper' require 'chef/knife/list_essentials' require 'chef/knife/show_essentials' describe 'General chef_repo file system checks' do extend IntegrationSupport include KnifeSupport context 'directories and files that should/should not be ignored' do when_the_repository "has empty roles, environments and data bag item directories" do directory "roles" directory "environments" directory "data_bags/bag1" it "knife list --local -Rfp / returns them" do knife('list --local -Rfp /').should_succeed < "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n") /cookbooks/ EOM end end when_the_repository "has only empty cookbook subdirectories" do directory 'cookbooks/cookbook1/recipes' it "knife list --local -Rfp / does not return it" do knife('list --local -Rfp /').should_succeed(< "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n") /cookbooks/ EOM end end when_the_repository "has empty and non-empty cookbook subdirectories" do directory 'cookbooks/cookbook1/recipes' file 'cookbooks/cookbook1/templates/default/x.txt', '' it "knife list --local -Rfp / does not return the empty ones" do knife('list --local -Rfp /').should_succeed < "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n") /cookbooks/ EOM end end when_the_repository "has empty cookbook sub-sub-directories alongside non-empty ones" do file 'cookbooks/cookbook1/templates/default/x.txt', '' directory 'cookbooks/cookbook1/templates/rhel' directory 'cookbooks/cookbook1/files/default' it "knife list --local -Rfp / does not return the empty ones" do knife('list --local -Rfp /').should_succeed <