core: MixinSyncedFolders lets a custom config through
This commit is contained in:
parent
c1f14320bd
commit
d8bdb62ed4
|
@ -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]
|
||||
|
||||
|
|
|
@ -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" }
|
||||
|
|
Loading…
Reference in New Issue