Sha256: c70466672f7c01c1ea52f258f3ff7e62d82fed8aa7e53e50324f3c76b05d50c4
Contents?: true
Size: 1.23 KB
Versions: 6
Compression:
Stored size: 1.23 KB
Contents
require File.join(File.dirname(__FILE__), 'support', 'spec_helper') require 'albacore/ssh' describe Ssh, 'when executing a command over ssh' do before :each do @sshstub = Net::SSH::Connection::Session.stub_instance(:exec! => nil) Net::SSH.stub_method(:start, &lambda{}).yields(@sshstub) @ssh = Ssh.new @ssh.server="server" @ssh.username="user" @ssh.password="secret" @ssh.commands "execute THIS!" @ssh.execute end it "should attempt to open a connection with the supplied connection information" do Net::SSH.should have_received(:start) end it "should execute the command" do @sshstub.should have_received(:exec!) end end describe Ssh, "when executing multiple commands over ssh" do before :each do @sshstub = Net::SSH::Connection::Session.stub_instance(:exec! => nil) Net::SSH.stub_method(:start, &lambda{}).yields(@sshstub) @ssh = Ssh.new @ssh.server="server" @ssh.username="user" @ssh.password="secret" @ssh.commands "execute THIS!", "another execution" @ssh.execute end it "should execute all of the specified commands" do @sshstub.should have_received(:exec!).twice end end
Version data entries
6 entries across 6 versions & 1 rubygems