more passing tests on Windows

This commit is contained in:
Mitchell Hashimoto 2015-11-20 15:09:17 -08:00
parent 1d92610535
commit fafd8b8986
3 changed files with 11 additions and 5 deletions

View File

@ -4,6 +4,8 @@ require "tmpdir"
require "log4r"
require "vagrant/util/platform"
# This class manages an isolated environment for Vagrant to
# run in. It creates a temporary directory to act as the
# working directory as well as sets a custom home directory.
@ -26,7 +28,7 @@ class IsolatedEnvironment
@logger = Log4r::Logger.new("test::isolated_environment")
# Create a temporary directory for our work
@tempdir = Dir.mktmpdir("vagrant")
@tempdir = Vagrant::Util::Platform.fs_real_path(Dir.mktmpdir("vagrant"))
@logger.info("Initialize isolated environment: #{@tempdir}")
# Setup the home and working directories

View File

@ -1,6 +1,8 @@
require "tempfile"
require "tmpdir"
require "vagrant/util/platform"
require "unit/support/isolated_environment"
shared_context "unit" do
@ -83,7 +85,9 @@ shared_context "unit" do
@_temp_files << d
# Return the pathname
return Pathname.new(d)
result = Pathname.new(Vagrant::Util::Platform.fs_real_path(d))
yield result if block_given?
return result
end
# Stub the given environment in ENV, without actually touching ENV. Keys and

View File

@ -69,15 +69,15 @@ describe Vagrant::Environment do
describe "#home_path" do
it "is set to the home path given" do
Dir.mktmpdir do |dir|
temporary_dir do |dir|
instance = described_class.new(home_path: dir)
expect(instance.home_path).to eq(Pathname.new(dir))
end
end
it "is set to the environmental variable VAGRANT_HOME" do
Dir.mktmpdir do |dir|
instance = with_temp_env("VAGRANT_HOME" => dir) do
temporary_dir do |dir|
instance = with_temp_env("VAGRANT_HOME" => dir.to_s) do
described_class.new
end