Sha256: 00527bc976652e0ace585cc60a619bf5e999300733dd2286963427fbbfe33a66

Contents?: true

Size: 1.11 KB

Versions: 10

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe Chake::Connection::Ssh do
  include_examples 'Chake::Connection', Chake::Connection::Ssh

  let(:node) { Chake::Node.new('ssh://myuser@myhost/srv/chake') }

  it('runs commands with ssh') { expect(connection.command_runner).to eq(['ssh', 'myuser@myhost']) }

  it('rsyncs over ssh') { expect(connection.rsync_dest).to eq('myuser@myhost:/srv/chake/') }

  it 'uses no remote username if none was passed' do
    node = Chake::Node.new('theserver')
    expect(node.username).to eq(Etc.getpwuid.name)
    expect(node.remote_username).to be_nil
  end

  it 'uses username is passwd' do
    expect(node.username).to eq('myuser')
    expect(node.remote_username).to eq('myuser')
  end

  context 'with a custom port' do
    let(:node) { Chake::Node.new('ssh://myhost:2222') }
    it 'uses port with ssh' do
      expect(connection.command_runner).to eq(['ssh', '-p', '2222', 'myhost'])
    end
    it 'uses port with scp' do
      expect(connection.scp).to eq(['scp', '-P', '2222'])
    end
    it 'uses port with rsync' do
      expect(connection.send(:rsync_ssh)).to eq(['-e', 'ssh -p 2222'])
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
chake-0.92 spec/chake/backend/ssh_spec.rb
chake-0.91 spec/chake/backend/ssh_spec.rb
chake-0.90.3 spec/chake/backend/ssh_spec.rb
chake-0.90.2 spec/chake/backend/ssh_spec.rb
chake-0.90.1 spec/chake/backend/ssh_spec.rb
chake-0.90 spec/chake/backend/ssh_spec.rb
chake-0.82 spec/chake/backend/ssh_spec.rb
chake-0.81.1 spec/chake/backend/ssh_spec.rb
chake-0.81 spec/chake/backend/ssh_spec.rb
chake-0.80 spec/chake/backend/ssh_spec.rb