Add test for provider priority fix

This commit adds tests for possible future regressions for the bug fixed
in the commit: "Fix Vagrant not prioritizing configured providers
correctly".

Two very similar tests were added because whether the bug manifests
or not depends on the order in which the provider dictionary keys
are iterated, which is specific to the dictionary implementation.
This commit is contained in:
Alejandro Ojeda 2016-09-18 03:58:45 +02:00
parent 50ca748b5c
commit 0be221fbea
1 changed files with 24 additions and 0 deletions

View File

@ -866,6 +866,30 @@ VF
end
end
it "is the provider in the Vagrantfile that is usable even if only one specified (1)" do
subject.vagrantfile.config.vm.provider "foo"
subject.vagrantfile.config.vm.finalize!
plugin_providers[:foo] = [provider_usable_class(true), { priority: 5 }]
plugin_providers[:bar] = [provider_usable_class(true), { priority: 7 }]
with_temp_env("VAGRANT_DEFAULT_PROVIDER" => nil) do
expect(subject.default_provider).to eq(:foo)
end
end
it "is the provider in the Vagrantfile that is usable even if only one specified (2)" do
subject.vagrantfile.config.vm.provider "bar"
subject.vagrantfile.config.vm.finalize!
plugin_providers[:foo] = [provider_usable_class(true), { priority: 7 }]
plugin_providers[:bar] = [provider_usable_class(true), { priority: 5 }]
with_temp_env("VAGRANT_DEFAULT_PROVIDER" => nil) do
expect(subject.default_provider).to eq(:bar)
end
end
it "is the highest usable provider outside the Vagrantfile" do
subject.vagrantfile.config.vm.provider "foo"
subject.vagrantfile.config.vm.finalize!