providers/virtualbox: fix flaky test when rsync is not installed

test-only change

when rsync is not installed on the machine running the unit tests, the
prepare_nfs_settings tests end up calling the :nfs_installed capability
on the host, which fails on the fake host wired up in tests.

this adds some explicit stubbing to prevent the implicit assumption that
rsync is installed.
This commit is contained in:
Paul Hinze 2014-11-30 22:00:06 -06:00
parent 1c884fa4e5
commit 703c1f153b
1 changed files with 7 additions and 0 deletions

View File

@ -22,14 +22,21 @@ describe VagrantPlugins::ProviderVirtualBox::Action::PrepareNFSSettings do
let(:env) {{ machine: machine }} let(:env) {{ machine: machine }}
let(:app) { lambda { |*args| }} let(:app) { lambda { |*args| }}
let(:driver) { double("driver") } let(:driver) { double("driver") }
let(:host) { double("host") }
subject { described_class.new(app, env) } subject { described_class.new(app, env) }
before do before do
env[:test] = true env[:test] = true
allow(machine.env).to receive(:host) { host }
allow(host).to receive(:capability).with(:nfs_installed) { true }
end end
it "calls the next action in the chain" do it "calls the next action in the chain" do
driver.stub(read_network_interfaces: {2 => {type: :hostonly, hostonly: "vmnet2"}})
driver.stub(read_host_only_interfaces: [{name: "vmnet2", ip: "1.2.3.4"}])
allow(driver).to receive(:read_guest_ip).with(1).and_return("2.3.4.5")
called = false called = false
app = lambda { |*args| called = true } app = lambda { |*args| called = true }