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, #set_backtrace, #test_name, #to_s

Constructor Details

#initialize(test, exception) ⇒ Error

error results are generated by raising exceptions in tests



144
145
146
147
148
149
150
# File 'lib/assert/result.rb', line 144

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)


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

def error?; true; end

#nameObject



155
156
157
# File 'lib/assert/result.rb', line 155

def name
  "Error"
end

#to_symObject



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

def to_sym; :error; end

#traceObject

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



160
161
162
# File 'lib/assert/result.rb', line 160

def trace
  self.backtrace.to_s
end