Make sure allowed_synced_folder_types order overrides priority
This commit is contained in:
parent
d781dce8f8
commit
853042f2fa
|
@ -27,9 +27,11 @@ module Vagrant
|
|||
|
||||
allowed_types = machine.config.vm.allowed_synced_folder_types
|
||||
if allowed_types
|
||||
ordered = ordered.select do |_, key, impl|
|
||||
allowed_types.include? key
|
||||
end
|
||||
ordered = allowed_types.map do |type|
|
||||
ordered.find do |_, key, impl|
|
||||
key == type
|
||||
end
|
||||
end.compact
|
||||
end
|
||||
|
||||
# Find the proper implementation
|
||||
|
|
|
@ -53,6 +53,22 @@ describe Vagrant::Action::Builtin::MixinSyncedFolders do
|
|||
result = subject.default_synced_folder_type(machine, plugins)
|
||||
expect(result).to eq("good")
|
||||
end
|
||||
|
||||
it "reprioritizes based on allowed_synced_folder_types" do
|
||||
plugins = {
|
||||
"bad" => [impl(false, "bad"), 0],
|
||||
"good" => [impl(true, "good"), 1],
|
||||
"same" => [impl(true, "same"), 1],
|
||||
}
|
||||
|
||||
expect(vm_config).to receive(:allowed_synced_folder_types).and_return(["good", "same"])
|
||||
result = subject.default_synced_folder_type(machine, plugins)
|
||||
expect(result).to eq("good")
|
||||
|
||||
expect(vm_config).to receive(:allowed_synced_folder_types).and_return(["same", "good"])
|
||||
result = subject.default_synced_folder_type(machine, plugins)
|
||||
expect(result).to eq("same")
|
||||
end
|
||||
end
|
||||
|
||||
describe "impl_opts" do
|
||||
|
|
Loading…
Reference in New Issue