test/vagrant/environment_test.rb in vagrantup-0.6.4 vs test/vagrant/environment_test.rb in vagrantup-0.6.5
- old
+ new
@@ -127,17 +127,21 @@
vf
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
context "local data" do
should "lazy load the data store only once" do
result = { :foo => :bar }
@@ -359,11 +363,14 @@
clean_paths
@env = @klass.new(:cwd => vagrantfile)
end
def create_box_vagrantfile
- vagrantfile(vagrant_box("box"), 'config.package.name = "box.box"')
+ vagrantfile(vagrant_box("box"), <<-FILE)
+ config.package.name = "box.box"
+ config.vm.base_mac = "set"
+ FILE
end
def create_home_vagrantfile
vagrantfile(home_path, 'config.package.name = "home.box"')
end
@@ -394,18 +401,21 @@
assert_equal "root.box", @env.config.package.name
end
should "load from a sub-vm configuration if environment represents a VM" do
create_home_vagrantfile
+ create_box_vagrantfile
vagrantfile(@env.root_path, <<-vf)
config.package.name = "root.box"
config.vm.define :web do |web|
+ web.vm.box = "box"
web.package.name = "web.box"
end
vf
assert_equal "root.box", @env.config.package.name
assert_equal "web.box", @env.vms[:web].env.config.package.name
+ assert_equal "set", @env.vms[:web].env.config.vm.base_mac
end
should "reload the logger after executing" do
@env.load_config!
assert @env.instance_variable_get(:@logger).nil?