Tests for registering guest capabilities
This commit is contained in:
parent
c5c15fdaa6
commit
819ef46fca
|
@ -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?
|
||||
|
|
|
@ -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" }
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue