diff options
author | adamedx <adamed@opscode.com> | 2013-10-15 22:08:02 -0700 |
---|---|---|
committer | adamedx <adamed@opscode.com> | 2013-10-17 11:56:08 -0700 |
commit | 9bb1c68605f1bf2db5c67f9b20ec7e4990a4ee2f (patch) | |
tree | 0518f5bfcf5a16ea275258d39159b15a40ac68c2 /spec/unit/provider/remote_file | |
parent | 63395853fa79f4d4086fac92f76a97840b299b1a (diff) | |
download | chef-9bb1c68605f1bf2db5c67f9b20ec7e4990a4ee2f.tar.gz |
CHEF-4625: Explicitly close temp files to prevent sharing violations
Diffstat (limited to 'spec/unit/provider/remote_file')
-rw-r--r-- | spec/unit/provider/remote_file/local_file_spec.rb | 3 |
1 files changed, 2 insertions, 1 deletions
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 |