From 68923ff556961706d2aca987f39845d1eeac59e5 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 3 Nov 2012 21:30:22 -0700 Subject: [PATCH] Additional tests for the plugin manager. --- test/unit/vagrant/plugin/v1/manager_test.rb | 78 ++++++++++++++++++++- 1 file changed, 76 insertions(+), 2 deletions(-) diff --git a/test/unit/vagrant/plugin/v1/manager_test.rb b/test/unit/vagrant/plugin/v1/manager_test.rb index a58e1b0fe..f4b38d608 100644 --- a/test/unit/vagrant/plugin/v1/manager_test.rb +++ b/test/unit/vagrant/plugin/v1/manager_test.rb @@ -11,14 +11,88 @@ describe Vagrant::Plugin::V1::Manager do p end + it "should enumerate registered communicator classes" do + pA = plugin do |p| + p.communicator("foo") { "bar" } + end + + pB = plugin do |p| + p.communicator("bar") { "baz" } + end + + instance.register(pA) + instance.register(pB) + + instance.communicators.length.should == 2 + instance.communicators[:foo].should == "bar" + instance.communicators[:bar].should == "baz" + end + it "should enumerate registered configuration classes" do pA = plugin do |p| p.config("foo") { "bar" } end - instance.register(pA) + pB = plugin do |p| + p.config("bar") { "baz" } + end - instance.config.length.should == 1 + instance.register(pA) + instance.register(pB) + + instance.config.length.should == 2 instance.config[:foo].should == "bar" + instance.config[:bar].should == "baz" + end + + it "should enumerate registered guest classes" do + pA = plugin do |p| + p.guest("foo") { "bar" } + end + + pB = plugin do |p| + p.guest("bar") { "baz" } + end + + instance.register(pA) + instance.register(pB) + + instance.guests.length.should == 2 + instance.guests[:foo].should == "bar" + instance.guests[:bar].should == "baz" + end + + it "should enumerate registered host classes" do + pA = plugin do |p| + p.host("foo") { "bar" } + end + + pB = plugin do |p| + p.host("bar") { "baz" } + end + + instance.register(pA) + instance.register(pB) + + instance.hosts.length.should == 2 + instance.hosts[:foo].should == "bar" + instance.hosts[:bar].should == "baz" + end + + it "should enumerate registered provider classes" do + pA = plugin do |p| + p.provider("foo") { "bar" } + end + + pB = plugin do |p| + p.provider("bar") { "baz" } + end + + instance.register(pA) + instance.register(pB) + + instance.providers.length.should == 2 + instance.providers[:foo].should == "bar" + instance.providers[:bar].should == "baz" end end