From 9bb1c68605f1bf2db5c67f9b20ec7e4990a4ee2f Mon Sep 17 00:00:00 2001 From: adamedx Date: Tue, 15 Oct 2013 22:08:02 -0700 Subject: CHEF-4625: Explicitly close temp files to prevent sharing violations --- spec/unit/provider/remote_file/local_file_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'spec/unit/provider/remote_file') diff --git a/spec/unit/provider/remote_file/local_file_spec.rb b/spec/unit/provider/remote_file/local_file_spec.rb index 6b318f972a..00634f50eb 100644 --- a/spec/unit/provider/remote_file/local_file_spec.rb +++ b/spec/unit/provider/remote_file/local_file_spec.rb @@ -40,7 +40,7 @@ describe Chef::Provider::RemoteFile::LocalFile do describe "when fetching the object" do - let(:tempfile) { mock("Tempfile", :path => "/tmp/foo/bar/nyan.png") } + let(:tempfile) { mock("Tempfile", :path => "/tmp/foo/bar/nyan.png", :close => nil) } let(:chef_tempfile) { mock("Chef::FileContentManagement::Tempfile", :tempfile => tempfile) } before do @@ -50,6 +50,7 @@ describe Chef::Provider::RemoteFile::LocalFile do it "stages the local file to a temporary file" do Chef::FileContentManagement::Tempfile.should_receive(:new).with(new_resource).and_return(chef_tempfile) ::FileUtils.should_receive(:cp).with(uri.path, tempfile.path) + tempfile.should_receive(:close) result = fetcher.fetch result.should == tempfile -- cgit v1.2.1