spec/functional/resource/file_spec.rb in chef-11.4.4 vs spec/functional/resource/file_spec.rb in chef-11.6.0.hotfix.1

- old
+ new

@@ -30,11 +30,11 @@ run_context = Chef::RunContext.new(node, {}, events) resource = Chef::Resource::File.new(path, run_context) resource end - let!(:resource) do + let(:resource) do r = create_resource r.content(expected_content) r end @@ -55,9 +55,25 @@ let(:default_mode) { ((0100666 - File.umask) & 07777).to_s(8) } it_behaves_like "a file resource" it_behaves_like "a securable resource with reporting" + + describe "when running action :create without content" do + before do + resource_without_content.run_action(:create) + end + + context "and the target file does not exist" do + it "creates the file" do + File.should exist(path) + end + + it "is marked updated by last action" do + resource_without_content.should be_updated_by_last_action + end + end + end describe "when running action :touch" do context "and the target file does not exist" do before do resource.run_action(:touch)