Update environment to use new VirtualBox methods/attributes
This commit is contained in:
parent
ed3e86d20f
commit
068c0e67c5
|
@ -43,7 +43,7 @@ module Vagrant
|
|||
shared_folders.each do |name, hostpath, guestpath|
|
||||
folder = VirtualBox::SharedFolder.new
|
||||
folder.name = name
|
||||
folder.hostpath = hostpath
|
||||
folder.host_path = hostpath
|
||||
@runner.vm.shared_folders << folder
|
||||
end
|
||||
|
||||
|
|
|
@ -32,16 +32,12 @@ module Vagrant
|
|||
# VirtualBox installed is high enough. Also verifies that the
|
||||
# configuration path is properly set.
|
||||
def check_virtualbox!
|
||||
version = VirtualBox::Command.version
|
||||
version = VirtualBox.version
|
||||
if version.nil?
|
||||
error_and_exit(:virtualbox_not_detected)
|
||||
elsif version.to_f < 3.1
|
||||
error_and_exit(:virtualbox_invalid_version, :version => version.to_s)
|
||||
end
|
||||
|
||||
if !VirtualBox::Global.vboxconfig?
|
||||
error_and_exit(:virtualbox_xml_not_detected)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -79,8 +79,8 @@ class SharedFoldersActionTest < Test::Unit::TestCase
|
|||
should "add all shared folders to the VM" do
|
||||
share_seq = sequence("share_seq")
|
||||
shared_folders = mock("shared_folders")
|
||||
shared_folders.expects(:<<).in_sequence(share_seq).with() { |sf| sf.name == "foo" && sf.hostpath == "from" }
|
||||
shared_folders.expects(:<<).in_sequence(share_seq).with() { |sf| sf.name == "bar" && sf.hostpath == "bfrom" }
|
||||
shared_folders.expects(:<<).in_sequence(share_seq).with() { |sf| sf.name == "foo" && sf.host_path == "from" }
|
||||
shared_folders.expects(:<<).in_sequence(share_seq).with() { |sf| sf.name == "bar" && sf.host_path == "bfrom" }
|
||||
@vm.stubs(:shared_folders).returns(shared_folders)
|
||||
@vm.expects(:save).with(true).once
|
||||
|
||||
|
|
|
@ -7,33 +7,25 @@ class EnvironmentTest < Test::Unit::TestCase
|
|||
|
||||
context "class method check virtualbox version" do
|
||||
setup do
|
||||
VirtualBox::Command.stubs(:version).returns("3.1.4")
|
||||
VirtualBox::Global.stubs(:vboxconfig?).returns(true)
|
||||
VirtualBox.stubs(:version).returns("3.1.4")
|
||||
end
|
||||
|
||||
should "not error and exit if everything is good" do
|
||||
VirtualBox::Command.expects(:version).returns("3.1.4")
|
||||
VirtualBox::Global.expects(:vboxconfig?).returns(true)
|
||||
VirtualBox.expects(:version).returns("3.1.4")
|
||||
Vagrant::Environment.expects(:error_and_exit).never
|
||||
Vagrant::Environment.check_virtualbox!
|
||||
end
|
||||
|
||||
should "error and exit if VirtualBox is not installed or detected" do
|
||||
Vagrant::Environment.expects(:error_and_exit).with(:virtualbox_not_detected).once
|
||||
VirtualBox::Command.expects(:version).returns(nil)
|
||||
VirtualBox.expects(:version).returns(nil)
|
||||
Vagrant::Environment.check_virtualbox!
|
||||
end
|
||||
|
||||
should "error and exit if VirtualBox is lower than version 3.1" do
|
||||
version = "3.0.12r1041"
|
||||
Vagrant::Environment.expects(:error_and_exit).with(:virtualbox_invalid_version, :version => version.to_s).once
|
||||
VirtualBox::Command.expects(:version).returns(version)
|
||||
Vagrant::Environment.check_virtualbox!
|
||||
end
|
||||
|
||||
should "error and exit if the the vboxconfig is not set" do
|
||||
VirtualBox::Global.expects(:vboxconfig?).returns(false)
|
||||
Vagrant::Environment.expects(:error_and_exit).with(:virtualbox_xml_not_detected).once
|
||||
VirtualBox.expects(:version).returns(version)
|
||||
Vagrant::Environment.check_virtualbox!
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue