Sha256: 4669954c0ca1372fd380464d1c28d6c6820c759a9881e009fbc1e3934b573b2b

Contents?: true

Size: 1.31 KB

Versions: 32

Compression:

Stored size: 1.31 KB

Contents

# encoding: UTF-8

require 'winrm/psrp/message_data/base'
require 'winrm/psrp/message_data/error_record'

describe WinRM::PSRP::MessageData::ErrorRecord do
  let(:test_data_xml_template) do
    ERB.new(stubbed_clixml('error_record.xml.erb'))
  end
  let(:error_message) { 'an error' }
  let(:script_root) { 'script_root' }
  let(:category_message) { 'category message' }
  let(:stack_trace) { 'stack trace' }
  let(:error_id) { 'Microsoft.PowerShell.Commands.WriteErrorException' }
  let(:raw_data) { test_data_xml_template.result(binding) }
  subject { described_class.new(raw_data) }

  it 'returns the exception' do
    expect(subject.exception[:message]).to eq(error_message)
  end

  it 'returns the FullyQualifiedErrorId' do
    expect(subject.fully_qualified_error_id).to eq(error_id)
  end

  it 'returns the invocation info' do
    expect(subject.invocation_info[:line]).to eq("write-error '#{error_message}'")
  end

  it 'converts camel case properties to underscore' do
    expect(subject.invocation_info[:ps_script_root]).to eq(script_root)
  end

  it 'returns the error category message' do
    expect(subject.error_category_message).to eq(category_message)
  end

  it 'returns the script stack trace' do
    expect(subject.error_details_script_stack_trace).to eq(stack_trace)
  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/psrp/message_data/error_record_spec.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/psrp/message_data/error_record_spec.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/psrp/message_data/error_record_spec.rb
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/psrp/message_data/error_record_spec.rb
vagrant-unbundled-2.2.2.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/psrp/message_data/error_record_spec.rb
vagrant-unbundled-2.2.0.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/psrp/message_data/error_record_spec.rb
vagrant-unbundled-2.1.4.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/psrp/message_data/error_record_spec.rb
vagrant-unbundled-2.1.2.0 vendor/bundle/ruby/2.3.0/gems/winrm-2.2.3/tests/spec/psrp/message_data/error_record_spec.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/winrm-2.2.3/tests/spec/psrp/message_data/error_record_spec.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/winrm-2.2.3/tests/spec/psrp/message_data/error_record_spec.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/psrp/message_data/error_record_spec.rb
vagrant-unbundled-2.1.1.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/psrp/message_data/error_record_spec.rb
vagrant-unbundled-2.0.4.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/psrp/message_data/error_record_spec.rb
vagrant-unbundled-2.0.3.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/psrp/message_data/error_record_spec.rb
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.4.0/gems/winrm-2.2.3/tests/spec/psrp/message_data/error_record_spec.rb
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.5.0/gems/winrm-2.2.3/tests/spec/psrp/message_data/error_record_spec.rb
vagrant-unbundled-2.0.1.0 vendor/bundle/ruby/2.4.0/gems/winrm-2.2.3/tests/spec/psrp/message_data/error_record_spec.rb
vagrant-unbundled-2.0.0.1 vendor/bundle/ruby/2.4.0/gems/winrm-2.2.3/tests/spec/psrp/message_data/error_record_spec.rb
vagrant-unbundled-1.9.8.1 vendor/bundle/ruby/2.4.0/gems/winrm-2.2.3/tests/spec/psrp/message_data/error_record_spec.rb
vagrant-unbundled-1.9.7.1 vendor/bundle/ruby/2.4.0/gems/winrm-2.2.3/tests/spec/psrp/message_data/error_record_spec.rb