From 7f6a4fa3bdb54930c483badcd3d865aa33cd9220 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Fri, 24 Oct 2014 15:46:34 -0400 Subject: [PATCH] Add tests for plugin manager push_configs --- test/unit/vagrant/plugin/v2/manager_test.rb | 36 +++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/test/unit/vagrant/plugin/v2/manager_test.rb b/test/unit/vagrant/plugin/v2/manager_test.rb index 45ebd5a0c..3ddbf00e9 100644 --- a/test/unit/vagrant/plugin/v2/manager_test.rb +++ b/test/unit/vagrant/plugin/v2/manager_test.rb @@ -189,6 +189,42 @@ describe Vagrant::Plugin::V2::Manager do expect(instance.provider_configs[:bar]).to eq("bar") end + it "should enumerate registered push classes" do + pA = plugin do |p| + p.push("foo") { "bar" } + end + + pB = plugin do |p| + p.push("bar", foo: "bar") { "baz" } + end + + instance.register(pA) + instance.register(pB) + + expect(instance.pushes.to_hash.length).to eq(2) + expect(instance.pushes[:foo]).to eq(["bar", nil]) + expect(instance.pushes[:bar]).to eq(["baz", { foo: "bar" }]) + end + + it "provides the collection of registered push configs" do + pA = plugin do |p| + p.config("foo", :push) { "foo" } + end + + pB = plugin do |p| + p.config("bar", :push) { "bar" } + p.config("baz") { "baz" } + end + + instance.register(pA) + instance.register(pB) + + expect(instance.push_configs.to_hash.length).to eq(2) + expect(instance.push_configs[:foo]).to eq("foo") + expect(instance.push_configs[:bar]).to eq("bar") + end + + it "should enumerate all registered synced folder implementations" do pA = plugin do |p| p.synced_folder("foo") { "bar" }