Vagrantfiles with only one `config.vm.define` are now considered multi-VM.
This commit is contained in:
parent
ba9cb19808
commit
48e5f4fb86
|
@ -158,7 +158,7 @@ module Vagrant
|
||||||
if parent
|
if parent
|
||||||
parent.multivm?
|
parent.multivm?
|
||||||
else
|
else
|
||||||
vms.length > 1
|
vms.length > 1 || vms.keys.first != DEFAULT_VM
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -39,11 +39,11 @@ class CommandHelpersTest < Test::Unit::TestCase
|
||||||
|
|
||||||
context "without multivm" do
|
context "without multivm" do
|
||||||
setup do
|
setup do
|
||||||
@env.stubs(:vms).returns({ :one => 1 })
|
@env.stubs(:vms).returns({ :one => 1, :two => 2 })
|
||||||
end
|
end
|
||||||
|
|
||||||
should "raise an exception if a name is specified" do
|
should "raise an exception if a name is specified" do
|
||||||
instance = command(["foo"], @env)
|
instance = command(["foo"], vagrant_env)
|
||||||
assert_raises(Vagrant::Errors::MultiVMEnvironmentRequired) {
|
assert_raises(Vagrant::Errors::MultiVMEnvironmentRequired) {
|
||||||
instance.target_vms
|
instance.target_vms
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,12 +129,16 @@ class EnvironmentTest < Test::Unit::TestCase
|
||||||
assert env.multivm?
|
assert env.multivm?
|
||||||
end
|
end
|
||||||
|
|
||||||
should "return false if VM length is 1" do
|
should "return true if VM length is 1 and a sub-VM is defined" do
|
||||||
env = vagrant_env(vagrantfile(<<-vf))
|
env = vagrant_env(vagrantfile(<<-vf))
|
||||||
config.vm.define :web
|
config.vm.define :web
|
||||||
vf
|
vf
|
||||||
|
|
||||||
assert !env.multivm?
|
assert env.multivm?
|
||||||
|
end
|
||||||
|
|
||||||
|
should "return false if only default VM exists" do
|
||||||
|
assert !vagrant_env.multivm?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue