Sha256: 4cca2e299e7f405f9110cdaa24d7b9eef10ea2f40cc2c3b25d2bd584af736335

Contents?: true

Size: 1021 Bytes

Versions: 1

Compression:

Stored size: 1021 Bytes

Contents

require_relative 'spec_helper'

describe VagrantSsh::Shell do
  subject(:vagrant_ssh) { VagrantSsh::Shell.new(host, logger: nil_logger) }

  let(:credentials) { { user: 'vagrant', password: 'vagrant' } }
  let(:nil_logger) { Logger.new(nil) }
  let(:host) { '33.33.33.33' }

  it 'defaults to the standard Vagrant credentials' do
    expect(vagrant_ssh.options).to eq credentials
  end

  it 'should interface with a Vagrant VM correctly' do
    expect(vagrant_ssh.execute('whoami').strip).to eq 'vagrant'
  end

  context 'when modifying the defaults' do
    let(:non_default_credentials) { { user: 'foo', password: 'bar' } }

    it 'uses the provided credentials' do
      vagrant_ssh = VagrantSsh::Shell.new(host, logger: nil_logger, options: non_default_credentials)
      expect(vagrant_ssh.options[:user]).to eq 'foo'
      expect(vagrant_ssh.options[:password]).to eq 'bar'
    end
  end

  it 'provides the last exit code' do
    vagrant_ssh.execute('exit 1')
    expect(vagrant_ssh.exit_code).to eq 1
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-ssh-2.1.0 spec/vagrant_ssh_spec.rb