diff --git a/lib/vagrant/machine.rb b/lib/vagrant/machine.rb index 8d6e93761..47b23d202 100644 --- a/lib/vagrant/machine.rb +++ b/lib/vagrant/machine.rb @@ -170,7 +170,7 @@ module Vagrant # knows how to do guest-OS specific tasks, such as configuring networks, # mounting folders, etc. # - # @return [Object] + # @return [Guest] def guest raise Errors::MachineGuestNotReady if !communicate.ready? @guest.detect! if !@guest.ready? diff --git a/test/unit/vagrant/plugin/v2/manager_test.rb b/test/unit/vagrant/plugin/v2/manager_test.rb index d669a05f1..d0ab6fd58 100644 --- a/test/unit/vagrant/plugin/v2/manager_test.rb +++ b/test/unit/vagrant/plugin/v2/manager_test.rb @@ -103,6 +103,23 @@ describe Vagrant::Plugin::V2::Manager do instance.guests[:bar].should == ["baz", :foo] end + it "should enumerate registered guest capabilities" do + pA = plugin do |p| + p.guest_capability("foo", "foo") { "bar" } + end + + pB = plugin do |p| + p.guest_capability("bar", "foo") { "baz" } + end + + instance.register(pA) + instance.register(pB) + + instance.guest_capabilities.length.should == 2 + instance.guest_capabilities[:foo][:foo].should == "bar" + instance.guest_capabilities[:bar][:foo].should == "baz" + end + it "should enumerate registered host classes" do pA = plugin do |p| p.host("foo") { "bar" } diff --git a/test/unit/vagrant/plugin/v2/plugin_test.rb b/test/unit/vagrant/plugin/v2/plugin_test.rb index c00a8d9ca..0295b3242 100644 --- a/test/unit/vagrant/plugin/v2/plugin_test.rb +++ b/test/unit/vagrant/plugin/v2/plugin_test.rb @@ -176,6 +176,16 @@ describe Vagrant::Plugin::V2::Plugin do end end + describe "guest capabilities" do + it "should register guest capabilities" do + plugin = Class.new(described_class) do + guest_capability("foo", "bar") { "baz" } + end + + plugin.components.guest_capabilities[:foo][:bar].should == "baz" + end + end + describe "hosts" do it "should register host classes" do plugin = Class.new(described_class) do