Support configuring the version for test plugins.
This commit is contained in:
parent
d254d6f718
commit
253b433864
|
@ -18,6 +18,7 @@ shared_context "unit" do
|
|||
# Unregister each of the plugins we have may have temporarily
|
||||
# registered for the duration of this test.
|
||||
@_plugins.each do |plugin|
|
||||
Vagrant.plugin("1").manager.unregister(plugin)
|
||||
Vagrant.plugin("2").manager.unregister(plugin)
|
||||
end
|
||||
end
|
||||
|
@ -40,8 +41,9 @@ shared_context "unit" do
|
|||
#
|
||||
# @yield [plugin] Yields the plugin class for you to call the public
|
||||
# API that you need to.
|
||||
def register_plugin
|
||||
plugin = Class.new(Vagrant.plugin("2"))
|
||||
def register_plugin(version=nil)
|
||||
version ||= Vagrant::Config::CURRENT_VERSION
|
||||
plugin = Class.new(Vagrant.plugin(version))
|
||||
plugin.name("Test Plugin #{plugin.inspect}")
|
||||
yield plugin if block_given?
|
||||
@_plugins << plugin
|
||||
|
|
|
@ -21,7 +21,7 @@ describe Vagrant::Config::V1::Loader do
|
|||
stub_const("Vagrant::Config::CURRENT_VERSION", "1")
|
||||
|
||||
# Register some config classes.
|
||||
register_plugin do |p|
|
||||
register_plugin("1") do |p|
|
||||
p.config("foo") { OpenStruct }
|
||||
p.config("bar", true) { OpenStruct }
|
||||
end
|
||||
|
@ -37,7 +37,7 @@ describe Vagrant::Config::V1::Loader do
|
|||
stub_const("Vagrant::Config::CURRENT_VERSION", "2")
|
||||
|
||||
# Register some config classes.
|
||||
register_plugin do |p|
|
||||
register_plugin("1") do |p|
|
||||
p.config("foo") { OpenStruct }
|
||||
p.config("bar", true) { OpenStruct }
|
||||
end
|
||||
|
@ -52,7 +52,7 @@ describe Vagrant::Config::V1::Loader do
|
|||
describe "finalizing" do
|
||||
it "should call `#finalize` on the configuration object" do
|
||||
# Register a plugin for our test
|
||||
register_plugin do |plugin|
|
||||
register_plugin("1") do |plugin|
|
||||
plugin.config "foo" do
|
||||
Class.new do
|
||||
attr_accessor :bar
|
||||
|
@ -82,7 +82,7 @@ describe Vagrant::Config::V1::Loader do
|
|||
describe "loading" do
|
||||
it "should configure with all plugin config keys loaded" do
|
||||
# Register a plugin for our test
|
||||
register_plugin do |plugin|
|
||||
register_plugin("1") do |plugin|
|
||||
plugin.config("foo") { OpenStruct }
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue