Class: Assert::Result::Error

Inherits:
Base
  • Object
show all
Defined in:
lib/assert/result.rb,
lib/assert/result.rb

Instance Attribute Summary

Attributes inherited from Base

#backtrace, #message, #test

Instance Method Summary collapse

Methods inherited from Base

#==, #inspect, #test_name, #to_s

Constructor Details

#initialize(test, exception) ⇒ Error

error results are generated by raising exceptions in tests



199
200
201
202
203
204
205
# File 'lib/assert/result.rb', line 199

def initialize(test, exception)
  if exception.kind_of?(Exception)
    super(test, "#{exception.message} (#{exception.class.name})", exception.backtrace || [])
  else
    raise ArgumentError, "generate error results by raising an exception"
  end
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


207
# File 'lib/assert/result.rb', line 207

def error?; true; end

#nameObject



210
211
212
# File 'lib/assert/result.rb', line 210

def name
  "Error"
end

#to_symObject



208
# File 'lib/assert/result.rb', line 208

def to_sym; :error; end

#traceObject

override of the base, always show the full unfiltered backtrace for errors



215
216
217
# File 'lib/assert/result.rb', line 215

def trace
  self.backtrace.to_s
end