Vagrantfiles with only one `config.vm.define` are now considered multi-VM.

This commit is contained in:
Mitchell Hashimoto 2010-10-08 09:50:34 -07:00
parent ba9cb19808
commit 48e5f4fb86
3 changed files with 9 additions and 5 deletions

View File

@ -158,7 +158,7 @@ module Vagrant
if parent
parent.multivm?
else
vms.length > 1
vms.length > 1 || vms.keys.first != DEFAULT_VM
end
end

View File

@ -39,11 +39,11 @@ class CommandHelpersTest < Test::Unit::TestCase
context "without multivm" do
setup do
@env.stubs(:vms).returns({ :one => 1 })
@env.stubs(:vms).returns({ :one => 1, :two => 2 })
end
should "raise an exception if a name is specified" do
instance = command(["foo"], @env)
instance = command(["foo"], vagrant_env)
assert_raises(Vagrant::Errors::MultiVMEnvironmentRequired) {
instance.target_vms
}

View File

@ -129,12 +129,16 @@ class EnvironmentTest < Test::Unit::TestCase
assert env.multivm?
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))
config.vm.define :web
vf
assert !env.multivm?
assert env.multivm?
end
should "return false if only default VM exists" do
assert !vagrant_env.multivm?
end
end