Sha256: 49f6ab8ecfe8c40c501d964c8d48d445f011b3f59698450450e4ebc1f2168515

Contents?: true

Size: 1.34 KB

Versions: 32

Compression:

Stored size: 1.34 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

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/exception_spec.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/exception_spec.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/exception_spec.rb
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/exception_spec.rb
vagrant-unbundled-2.2.2.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/exception_spec.rb
vagrant-unbundled-2.2.0.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/exception_spec.rb
vagrant-unbundled-2.1.4.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/exception_spec.rb
vagrant-unbundled-2.1.2.0 vendor/bundle/ruby/2.3.0/gems/winrm-2.2.3/tests/spec/exception_spec.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/winrm-2.2.3/tests/spec/exception_spec.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/winrm-2.2.3/tests/spec/exception_spec.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/exception_spec.rb
vagrant-unbundled-2.1.1.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/exception_spec.rb
vagrant-unbundled-2.0.4.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/exception_spec.rb
vagrant-unbundled-2.0.3.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/exception_spec.rb
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.4.0/gems/winrm-2.2.3/tests/spec/exception_spec.rb
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/exception_spec.rb
vagrant-unbundled-2.0.1.0 vendor/bundle/ruby/2.4.0/gems/winrm-2.2.3/tests/spec/exception_spec.rb
vagrant-unbundled-2.0.0.1 vendor/bundle/ruby/2.4.0/gems/winrm-2.2.3/tests/spec/exception_spec.rb
vagrant-unbundled-1.9.8.1 vendor/bundle/ruby/2.4.0/gems/winrm-2.2.3/tests/spec/exception_spec.rb
vagrant-unbundled-1.9.7.1 vendor/bundle/ruby/2.4.0/gems/winrm-2.2.3/tests/spec/exception_spec.rb