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