core: tests for Guest#name
This commit is contained in:
parent
013a9ae779
commit
9fe702a000
|
@ -34,6 +34,13 @@ module Vagrant
|
|||
initialize_capabilities!(guest_name, @guests, @capabilities, @machine)
|
||||
end
|
||||
|
||||
# Returns the specified or detected guest type name.
|
||||
#
|
||||
# @return [Symbol]
|
||||
def name
|
||||
capability_host_chain[0][0]
|
||||
end
|
||||
|
||||
# This returns whether the guest is ready to work. If this returns
|
||||
# `false`, then {#detect!} should be called in order to detect the
|
||||
# guest OS.
|
||||
|
@ -42,12 +49,5 @@ module Vagrant
|
|||
def ready?
|
||||
!!capability_host_chain
|
||||
end
|
||||
|
||||
# Returns the specified or detected guest type name
|
||||
#
|
||||
# @return [Symbol]
|
||||
def name
|
||||
capability_host_chain[0][0]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -36,6 +36,16 @@ describe Vagrant::Guest do
|
|||
end
|
||||
end
|
||||
|
||||
describe "#name" do
|
||||
it "should be the name of the detected guest" do
|
||||
guests[:foo] = [detect_class(true), nil]
|
||||
guests[:bar] = [detect_class(false), nil]
|
||||
|
||||
subject.detect!
|
||||
expect(subject.name).to eql(:foo)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#ready?" do
|
||||
before(:each) do
|
||||
guests[:foo] = [detect_class(true), nil]
|
||||
|
|
Loading…
Reference in New Issue