Sha256: 9562ab1ef7994ec8bb4110cb744b706d121711dee07f92adee84398677225c58

Contents?: true

Size: 1.19 KB

Versions: 32

Compression:

Stored size: 1.19 KB

Contents

# encoding: UTF-8

require 'winrm'
require 'winrm/shells/cmd'
require 'winrm/shells/power_shell'

describe WinRM::Connection do
  context 'new' do
    it 'creates a new winrm session' do
      connection = WinRM::Connection.new(default_connection_opts)
      expect(connection).not_to be_nil
    end
  end

  context 'shell(:cmd)' do
    it 'creates a new cmd session' do
      connection = WinRM::Connection.new(default_connection_opts)
      cmd_shell = connection.shell(:cmd)
      expect(cmd_shell).not_to be_nil
      expect(cmd_shell).to be_an_instance_of(WinRM::Shells::Cmd)
    end
  end

  context 'shell(:powershell)' do
    it 'creates a new powershell session' do
      connection = WinRM::Connection.new(default_connection_opts)
      cmd_shell = connection.shell(:powershell)
      expect(cmd_shell).not_to be_nil
      expect(cmd_shell).to be_an_instance_of(WinRM::Shells::Powershell)
    end
  end

  context 'shell(:not_a_real_shell_type)' do
    it 'raises a descriptive error' do
      connection = WinRM::Connection.new(default_connection_opts)
      expect { connection.shell(:not_a_real_shell_type) }.to raise_error(WinRM::InvalidShellError)
    end
  end
end

Version data entries

32 entries across 29 versions & 3 rubygems

Version Path
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/winrm-2.2.3/tests/spec/connection_spec.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/connection_spec.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/connection_spec.rb
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/connection_spec.rb
vagrant-unbundled-2.2.2.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/connection_spec.rb
vagrant-unbundled-2.2.0.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/connection_spec.rb
vagrant-unbundled-2.1.4.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/connection_spec.rb
vagrant-unbundled-2.1.2.0 vendor/bundle/ruby/2.3.0/gems/winrm-2.2.3/tests/spec/connection_spec.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/winrm-2.2.3/tests/spec/connection_spec.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/winrm-2.2.3/tests/spec/connection_spec.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/connection_spec.rb
vagrant-unbundled-2.1.1.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/connection_spec.rb
vagrant-unbundled-2.0.4.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/connection_spec.rb
vagrant-unbundled-2.0.3.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/connection_spec.rb
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.4.0/gems/winrm-2.2.3/tests/spec/connection_spec.rb
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/connection_spec.rb
vagrant-unbundled-2.0.1.0 vendor/bundle/ruby/2.4.0/gems/winrm-2.2.3/tests/spec/connection_spec.rb
vagrant-unbundled-2.0.0.1 vendor/bundle/ruby/2.4.0/gems/winrm-2.2.3/tests/spec/connection_spec.rb
vagrant-unbundled-1.9.8.1 vendor/bundle/ruby/2.4.0/gems/winrm-2.2.3/tests/spec/connection_spec.rb
vagrant-unbundled-1.9.7.1 vendor/bundle/ruby/2.4.0/gems/winrm-2.2.3/tests/spec/connection_spec.rb