require 'support/shared/integration/integration_helper' require 'chef/mixin/shell_out' describe "LWRPs with inline resources" do include IntegrationSupport include Chef::Mixin::ShellOut let(:chef_dir) { File.join(File.dirname(__FILE__), "..", "..", "..", "bin") } # Invoke `chef-client` as `ruby PATH/TO/chef-client`. This ensures the # following constraints are satisfied: # * Windows: windows can only run batch scripts as bare executables. Rubygems # creates batch wrappers for installed gems, but we don't have batch wrappers # in the source tree. # * Other `chef-client` in PATH: A common case is running the tests on a # machine that has omnibus chef installed. In that case we need to ensure # we're running `chef-client` from the source tree and not the external one. # cf. CHEF-4914 let(:chef_client) { "ruby #{chef_dir}/chef-client" } when_the_repository "has a cookbook with a nested LWRP" do before do directory 'cookbooks/x' do file 'resources/do_nothing.rb', < chef_dir) actual = result.stdout.lines.map { |l| l.chomp }.join("\n") expected = <