Sha256: 4a59d73e934bc1fb0b513a3563a6b5df8020cd52d35827b0d7ad7b30265262c8

Contents?: true

Size: 1.35 KB

Versions: 4

Compression:

Stored size: 1.35 KB

Contents

# encoding: UTF-8
describe 'Exceptions', unit: true do
  describe WinRM::WinRMAuthorizationError do
    let(:error) { WinRM::WinRMHTTPTransportError.new('Foo happened', 500) }

    it 'adds the response code to the message' do
      expect(error.message).to eq('Foo happened (500).')
    end

    it 'exposes the response code as an attribute' do
      expect(error.status_code).to eq 500
    end

    it 'is a winrm error' do
      expect(error).to be_kind_of(WinRM::WinRMError)
    end
  end

  describe WinRM::WinRMWSManFault do
    let(:error) { WinRM::WinRMWSManFault.new('fault text', 42) }

    it 'exposes the fault text as an attribute' do
      expect(error.fault_description).to eq('fault text')
    end

    it 'exposes the fault code as an attribute' do
      expect(error.fault_code).to eq 42
    end

    it 'is a winrm error' do
      expect(error).to be_kind_of(WinRM::WinRMError)
    end
  end

  describe WinRM::WinRMWMIError do
    let(:error) { WinRM::WinRMWMIError.new('message text', 77_777) }

    it 'exposes the error text as an attribute' do
      expect(error.error).to eq('message text')
    end

    it 'exposes the error code as an attribute' do
      expect(error.error_code).to eq 77_777
    end

    it 'is a winrm error' do
      expect(error).to be_kind_of(WinRM::WinRMError)
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
winrm-1.7.3 spec/exception_spec.rb
winrm-1.7.1 spec/exception_spec.rb
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/winrm-1.3.6/spec/exception_spec.rb
winrm-1.3.6 spec/exception_spec.rb