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)
|
initialize_capabilities!(guest_name, @guests, @capabilities, @machine)
|
||||||
end
|
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
|
# This returns whether the guest is ready to work. If this returns
|
||||||
# `false`, then {#detect!} should be called in order to detect the
|
# `false`, then {#detect!} should be called in order to detect the
|
||||||
# guest OS.
|
# guest OS.
|
||||||
|
@ -42,12 +49,5 @@ module Vagrant
|
||||||
def ready?
|
def ready?
|
||||||
!!capability_host_chain
|
!!capability_host_chain
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns the specified or detected guest type name
|
|
||||||
#
|
|
||||||
# @return [Symbol]
|
|
||||||
def name
|
|
||||||
capability_host_chain[0][0]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -36,6 +36,16 @@ describe Vagrant::Guest do
|
||||||
end
|
end
|
||||||
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
|
describe "#ready?" do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
guests[:foo] = [detect_class(true), nil]
|
guests[:foo] = [detect_class(true), nil]
|
||||||
|
|
Loading…
Reference in New Issue