From e7e8a39c554ffce1e308b07fb71ef5b07a7c6cc3 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Thu, 25 Apr 2019 10:44:25 -0700 Subject: [PATCH] Stub the ssh path used for exec Since a full path to the ssh executable is being used and is expected at a specific location, default to providing that location when looking up the executable. This prevents errors from occurring when a host system provides an `ssh` match at a different path. --- test/unit/vagrant/util/ssh_test.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/unit/vagrant/util/ssh_test.rb b/test/unit/vagrant/util/ssh_test.rb index 9d84f0225..1a8b0a5d6 100644 --- a/test/unit/vagrant/util/ssh_test.rb +++ b/test/unit/vagrant/util/ssh_test.rb @@ -41,6 +41,10 @@ describe Vagrant::Util::SSH do let(:ssh_path) { "/usr/bin/ssh" } + before { + allow(Vagrant::Util::Which).to receive(:which).with("ssh", any_args).and_return(ssh_path) + } + it "searches original PATH for executable" do expect(Vagrant::Util::Which).to receive(:which).with("ssh", original_path: true).and_return("valid-return") allow(Vagrant::Util::SafeExec).to receive(:exec).and_return(nil)