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.
This commit is contained in:
Chris Roberts 2019-04-25 10:44:25 -07:00
parent 5b94bbb49b
commit e7e8a39c55
1 changed files with 4 additions and 0 deletions

View File

@ -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)