core: provider has default priority of 5
This commit is contained in:
parent
b6a61d8922
commit
429bd73495
|
@ -185,9 +185,11 @@ module Vagrant
|
|||
# Registers additional providers to be available.
|
||||
#
|
||||
# @param [Symbol] name Name of the provider.
|
||||
def self.provider(name=UNSET_VALUE, options=nil, &block)
|
||||
def self.provider(name=UNSET_VALUE, **options, &block)
|
||||
options[:priority] ||= 5
|
||||
|
||||
components.providers.register(name.to_sym) do
|
||||
[block.call, options || {}]
|
||||
[block.call, options]
|
||||
end
|
||||
|
||||
nil
|
||||
|
|
|
@ -249,7 +249,9 @@ describe Vagrant::Plugin::V2::Plugin do
|
|||
provider("foo") { "bar" }
|
||||
end
|
||||
|
||||
expect(plugin.components.providers[:foo]).to eq(["bar", {}])
|
||||
result = plugin.components.providers[:foo]
|
||||
expect(result[0]).to eq("bar")
|
||||
expect(result[1][:priority]).to eq(5)
|
||||
end
|
||||
|
||||
it "should register provider classes with options" do
|
||||
|
@ -257,7 +259,10 @@ describe Vagrant::Plugin::V2::Plugin do
|
|||
provider("foo", foo: "yep") { "bar" }
|
||||
end
|
||||
|
||||
expect(plugin.components.providers[:foo]).to eq(["bar", { foo: "yep" }])
|
||||
result = plugin.components.providers[:foo]
|
||||
expect(result[0]).to eq("bar")
|
||||
expect(result[1][:priority]).to eq(5)
|
||||
expect(result[1][:foo]).to eq("yep")
|
||||
end
|
||||
|
||||
it "should lazily register provider classes" do
|
||||
|
|
Loading…
Reference in New Issue