core: MixinSyncedFolders lets a custom config through

This commit is contained in:
Mitchell Hashimoto 2014-04-16 10:58:56 -07:00
parent c1f14320bd
commit d8bdb62ed4
2 changed files with 18 additions and 2 deletions

View File

@ -59,12 +59,13 @@ module Vagrant
# implementation class for the synced folders.
#
# @return [Hash<Symbol, Hash<String, Hash>>]
def synced_folders(machine)
def synced_folders(machine, config=nil)
config ||= machine.config.vm
folders = {}
# Determine all the synced folders as well as the implementation
# they're going to use.
machine.config.vm.synced_folders.each do |id, data|
config.synced_folders.each do |id, data|
# Ignore disabled synced folders
next if data[:disabled]

View File

@ -88,6 +88,21 @@ describe Vagrant::Action::Builtin::MixinSyncedFolders do
expect(result[:nfs]).to eq({ "nfs" => folders["nfs"] })
end
it "should return the proper set of folders of a custom config" do
folders["root"] = {}
folders["another"] = {}
other_folders = { "bar" => {} }
other = double("config")
other.stub(synced_folders: other_folders)
result = subject.synced_folders(machine, other)
expect(result.length).to eq(1)
expect(result[:default]).to eq({
"bar" => other_folders["bar"],
})
end
it "should error if an explicit type is unusable" do
plugins[:unusable] = [impl(false, "bad"), 15]
folders["root"] = { type: "unusable" }