Class: CemAcpt::TestRunner::TestResults::TestErrorActionResult

Inherits:
Object
  • Object
show all
Defined in:
lib/cem_acpt/test_runner/test_results.rb

Overview

Wrapper class for an error raised during an action.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error, log_formatter = nil) ⇒ TestErrorActionResult

Returns a new instance of TestErrorActionResult.



97
98
99
100
# File 'lib/cem_acpt/test_runner/test_results.rb', line 97

def initialize(error, log_formatter = nil)
  @error = error
  @log_formatter = log_formatter
end

Instance Attribute Details

#errorObject (readonly) Also known as: result

Returns the value of attribute error.



95
96
97
# File 'lib/cem_acpt/test_runner/test_results.rb', line 95

def error
  @error
end

#log_formatterObject (readonly)

Returns the value of attribute log_formatter.



95
96
97
# File 'lib/cem_acpt/test_runner/test_results.rb', line 95

def log_formatter
  @log_formatter
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


103
104
105
# File 'lib/cem_acpt/test_runner/test_results.rb', line 103

def error?
  true
end

#inspectObject



115
116
117
# File 'lib/cem_acpt/test_runner/test_results.rb', line 115

def inspect
  to_s
end

#resultsObject



132
133
134
# File 'lib/cem_acpt/test_runner/test_results.rb', line 132

def results
  [summary, "Class: #{@error.class.name}", @error.backtrace.join("\n")]
end

#results?Boolean

Returns:

  • (Boolean)


136
137
138
# File 'lib/cem_acpt/test_runner/test_results.rb', line 136

def results?
  true
end

#statusObject Also known as: http_status



127
128
129
# File 'lib/cem_acpt/test_runner/test_results.rb', line 127

def status
  1
end

#success?Boolean

Returns:

  • (Boolean)


107
108
109
# File 'lib/cem_acpt/test_runner/test_results.rb', line 107

def success?
  false
end

#summaryObject



140
141
142
# File 'lib/cem_acpt/test_runner/test_results.rb', line 140

def summary
  @error.message
end

#summary?Boolean

Returns:

  • (Boolean)


144
145
146
# File 'lib/cem_acpt/test_runner/test_results.rb', line 144

def summary?
  true
end

#to_hObject



119
120
121
122
123
124
125
# File 'lib/cem_acpt/test_runner/test_results.rb', line 119

def to_h
  {
    class: @error.class.name,
    message: @error.message,
    backtrace: @error.backtrace,
  }
end

#to_sObject



111
112
113
# File 'lib/cem_acpt/test_runner/test_results.rb', line 111

def to_s
  "#<#{@error.class.name}:0x#{@error.object_id.to_s(16)}>"
end