Tests for SSHExec, and forward in the ssh options

This commit is contained in:
Mitchell Hashimoto 2012-08-05 18:37:41 -07:00
parent e0ec679838
commit 8d50c4774e
2 changed files with 27 additions and 4 deletions

View File

@ -28,8 +28,7 @@ module Vagrant
SSH.check_key_permissions(info[:private_key_path])
# Exec!
# XXX: Options given in env
SSH.exec(info)
SSH.exec(info, env[:ssh_opts])
end
end
end

View File

@ -11,12 +11,36 @@ describe Vagrant::Action::Builtin::SSHExec do
result
end
let(:machine_ssh_info) { {} }
let(:ssh_klass) { Vagrant::Util::SSH }
before(:each) do
# Stub the methods so that even if we test incorrectly, no side
# effects actually happen.
ssh_klass.stub(:check_key_permissions)
ssh_klass.stub(:exec)
end
it "should check key permissions then exec" do
pending
ssh_klass.should_receive(:check_key_permissions).
with(machine_ssh_info[:private_key_path]).
once.
ordered
ssh_klass.should_receive(:exec).
with(machine_ssh_info, nil).
once.
ordered
described_class.new(app, env).call(env)
end
it "should exec with the options given in `ssh_opts`" do
pending
ssh_opts = { :foo => :bar }
ssh_klass.should_receive(:exec).
with(machine_ssh_info, ssh_opts)
env[:ssh_opts] = ssh_opts
described_class.new(app, env).call(env)
end
end