provider/virtualbox: fix NFS tests on Windows

This commit is contained in:
Mitchell Hashimoto 2014-01-15 11:48:07 -08:00
parent e2ec46bb4d
commit 35a19f829c
2 changed files with 19 additions and 20 deletions

View File

@ -58,7 +58,7 @@ module Vagrant
# This expands the path and ensures proper casing of each part # This expands the path and ensures proper casing of each part
# of the path. # of the path.
def fs_real_path(path) def fs_real_path(path, **opts)
path = Pathname.new(File.expand_path(path)) path = Pathname.new(File.expand_path(path))
if path.exist? && !fs_case_sensitive? if path.exist? && !fs_case_sensitive?

View File

@ -1,31 +1,27 @@
require_relative "../base" require_relative "../base"
require "vagrant/util/platform"
describe VagrantPlugins::ProviderVirtualBox::Action::PrepareNFSSettings do describe VagrantPlugins::ProviderVirtualBox::Action::PrepareNFSSettings do
include_context "unit" include_context "unit"
include_context "virtualbox" include_context "virtualbox"
let(:machine) { let(:iso_env) do
environment = Vagrant::Environment.new # We have to create a Vagrantfile so there is a root path
provider = :virtualbox env = isolated_environment
provider_cls, provider_options = Vagrant.plugin("2").manager.providers[provider] env.vagrantfile("")
provider_config = Vagrant.plugin("2").manager.provider_configs[provider] env.create_vagrant_env
end
Vagrant::Machine.new( let(:machine) do
'test_machine', iso_env.machine(iso_env.machine_names[0], :dummy).tap do |m|
provider, m.provider.stub(driver: driver)
provider_cls, end
provider_config, end
provider_options,
environment.config_global,
Pathname('data_dir'),
double('box'),
environment
)
}
let(:env) {{ machine: machine }} let(:env) {{ machine: machine }}
let(:app) { lambda { |*args| }} let(:app) { lambda { |*args| }}
let(:driver) { env[:machine].provider.driver } let(:driver) { double("driver") }
subject { described_class.new(app, env) } subject { described_class.new(app, env) }
@ -41,7 +37,10 @@ describe VagrantPlugins::ProviderVirtualBox::Action::PrepareNFSSettings do
context "with an nfs synced folder" do context "with an nfs synced folder" do
before do before do
env[:machine].config.vm.synced_folder("/host/path", "/guest/path", nfs: true) # We can't be on Windows, because NFS gets disabled on Windows
Vagrant::Util::Platform.stub(windows?: false)
env[:machine].config.vm.synced_folder("/host/path", "/guest/path", type: "nfs")
env[:machine].config.finalize! env[:machine].config.finalize!
# Stub out the stuff so it just works by default # Stub out the stuff so it just works by default