Sha256: b26e66bffce7209f2bc9f1e4a6b61323db91524c7e3c93ba0e1c9c26908d032e

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

# encoding: UTF-8
describe 'Exceptions' 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

1 entries across 1 versions & 1 rubygems

Version Path
winrm-2.1.0 tests/spec/exception_spec.rb