From 8a56d0ae5e133ed40ab2c69c9509410ccf137f13 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 15 Jan 2014 11:24:03 -0800 Subject: [PATCH] core: be sure to close tempfile handle so Windows can delete it --- test/unit/vagrant/environment_test.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/unit/vagrant/environment_test.rb b/test/unit/vagrant/environment_test.rb index 5c120a9a3..b3c863d93 100644 --- a/test/unit/vagrant/environment_test.rb +++ b/test/unit/vagrant/environment_test.rb @@ -5,6 +5,7 @@ require "tempfile" require "tmpdir" require "vagrant/util/file_mode" +require "vagrant/util/platform" describe Vagrant::Environment do include_context "unit" @@ -287,7 +288,12 @@ describe Vagrant::Environment do end describe "upgrading V1 dotfiles" do - let(:v1_dotfile_tempfile) { Tempfile.new("vagrant") } + let(:v1_dotfile_tempfile) do + Tempfile.new("vagrant").tap do |f| + f.close + end + end + let(:v1_dotfile) { Pathname.new(v1_dotfile_tempfile.path) } let(:local_data_path) { v1_dotfile_tempfile.path } let(:instance) { described_class.new(:local_data_path => local_data_path) } @@ -343,7 +349,10 @@ describe Vagrant::Environment do pk = env.homedir.join("insecure_private_key") pk.should be_exist - Vagrant::Util::FileMode.from_octal(pk.stat.mode).should == "600" + + if !Vagrant::Util::Platform.windows? + Vagrant::Util::FileMode.from_octal(pk.stat.mode).should == "600" + end end end