core: get tests passing on Windows, more tweaks

This commit is contained in:
Mitchell Hashimoto 2014-01-15 21:30:47 -08:00
parent 8a1995bec9
commit 2dff1ac417
2 changed files with 13 additions and 3 deletions

View File

@ -60,7 +60,7 @@ describe VagrantPlugins::SyncedFolderRSync::RsyncHelper do
Vagrant::Util::Platform.should_receive(:cygwin_windows_path).and_return("foo") Vagrant::Util::Platform.should_receive(:cygwin_windows_path).and_return("foo")
Vagrant::Util::Subprocess.should_receive(:execute).with do |*args| Vagrant::Util::Subprocess.should_receive(:execute).with do |*args|
expect(args[args.length - 3]).to eql("foo") expect(args[args.length - 3]).to eql("foo/")
end end
subject.rsync_single(machine, ssh_info, opts) subject.rsync_single(machine, ssh_info, opts)
@ -80,7 +80,8 @@ describe VagrantPlugins::SyncedFolderRSync::RsyncHelper do
opts[:guestpath] = "/bar" opts[:guestpath] = "/bar"
Vagrant::Util::Subprocess.should_receive(:execute).with do |*args| Vagrant::Util::Subprocess.should_receive(:execute).with do |*args|
expect(args[args.length - 3]).to eql(Vagrant::Util::Platform.fs_real_path("/foo").to_s) expected = Vagrant::Util::Platform.fs_real_path("/foo").to_s
expect(args[args.length - 3]).to eql("#{expected}/")
expect(args[args.length - 2]).to include("/bar") expect(args[args.length - 2]).to include("/bar")
end end
@ -94,7 +95,7 @@ describe VagrantPlugins::SyncedFolderRSync::RsyncHelper do
hostpath_expanded = File.expand_path(opts[:hostpath], machine.env.root_path) hostpath_expanded = File.expand_path(opts[:hostpath], machine.env.root_path)
Vagrant::Util::Subprocess.should_receive(:execute).with do |*args| Vagrant::Util::Subprocess.should_receive(:execute).with do |*args|
expect(args[args.length - 3]).to eql(hostpath_expanded) expect(args[args.length - 3]).to eql("#{hostpath_expanded}/")
expect(args[args.length - 2]).to include("/bar") expect(args[args.length - 2]).to include("/bar")
end end

View File

@ -1,4 +1,6 @@
shared_context "virtualbox" do shared_context "virtualbox" do
include_context "unit"
let(:vbox_context) { true } let(:vbox_context) { true }
let(:uuid) { "1234-abcd-5678-efgh" } let(:uuid) { "1234-abcd-5678-efgh" }
let(:vbox_version) { "4.3.4" } let(:vbox_version) { "4.3.4" }
@ -27,4 +29,11 @@ shared_context "virtualbox" do
with("VBoxManage", "showvminfo", kind_of(String), kind_of(Hash)). with("VBoxManage", "showvminfo", kind_of(String), kind_of(Hash)).
and_return(subprocess_result(exit_code: 0)) and_return(subprocess_result(exit_code: 0))
end end
around do |example|
# On Windows, we don't want to accidentally call the actual VirtualBox
with_temp_env("VBOX_INSTALL_PATH" => nil) do
example.run
end
end
end end