Class: Torkify::Event::PassOrFailEvent

Inherits:
Struct
  • Object
show all
Includes:
Message
Defined in:
lib/torkify/event/pass_or_fail_event.rb

Overview

Event used for test passes or failures.

Types:

- pass
- fail

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Message

#message

Instance Attribute Details

#exit_codeObject

Returns the value of attribute exit_code

Returns:

  • (Object)

    the current value of exit_code



11
12
13
# File 'lib/torkify/event/pass_or_fail_event.rb', line 11

def exit_code
  @exit_code
end

#exit_infoObject

Returns the value of attribute exit_info

Returns:

  • (Object)

    the current value of exit_info



11
12
13
# File 'lib/torkify/event/pass_or_fail_event.rb', line 11

def exit_info
  @exit_info
end

#fileObject

Returns the value of attribute file

Returns:

  • (Object)

    the current value of file



11
12
13
# File 'lib/torkify/event/pass_or_fail_event.rb', line 11

def file
  @file
end

#linesObject

Returns the value of attribute lines

Returns:

  • (Object)

    the current value of lines



11
12
13
# File 'lib/torkify/event/pass_or_fail_event.rb', line 11

def lines
  @lines
end

#log_fileObject

Returns the value of attribute log_file

Returns:

  • (Object)

    the current value of log_file



11
12
13
# File 'lib/torkify/event/pass_or_fail_event.rb', line 11

def log_file
  @log_file
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



11
12
13
# File 'lib/torkify/event/pass_or_fail_event.rb', line 11

def type
  @type
end

#workerObject

Returns the value of attribute worker

Returns:

  • (Object)

    the current value of worker



11
12
13
# File 'lib/torkify/event/pass_or_fail_event.rb', line 11

def worker
  @worker
end

Instance Method Details

#errorsObject



20
21
22
# File 'lib/torkify/event/pass_or_fail_event.rb', line 20

def errors
  @errors ||= parse_errors_from_log
end

#pidObject

Get the PID from the exit info.



15
16
17
18
# File 'lib/torkify/event/pass_or_fail_event.rb', line 15

def pid
  matched = exit_info.scan(/pid ([0-9]+)/).first
  matched.first.to_i if matched
end

#to_sObject



24
25
26
27
# File 'lib/torkify/event/pass_or_fail_event.rb', line 24

def to_s
  s = "#{type.upcase} #{file}"
  s += lines.any? ? " (lines #{lines.join(', ')})" : ''
end