Class: Sus::Assertions::Error

Inherits:
Object
  • Object
show all
Defined in:
lib/sus/assertions.rb

Overview

Represents an error that occurred during test execution.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identity, error) ⇒ Error

Initialize a new error result.



312
313
314
315
# File 'lib/sus/assertions.rb', line 312

def initialize(identity, error)
	@identity = identity
	@error = error
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



321
322
323
# File 'lib/sus/assertions.rb', line 321

def error
  @error
end

#identityObject (readonly)

Returns the value of attribute identity.



318
319
320
# File 'lib/sus/assertions.rb', line 318

def identity
  @identity
end

Instance Method Details

#each_failure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



324
325
326
# File 'lib/sus/assertions.rb', line 324

def each_failure(&block)
	yield self
end

#messageObject



329
330
331
332
333
334
# File 'lib/sus/assertions.rb', line 329

def message
	{
		text: @error.full_message,
		location: @identity&.to_location
	}
end

#The exception that was raised.=(exceptionthatwasraised. = (value)) ⇒ Object



321
# File 'lib/sus/assertions.rb', line 321

attr :error

#The identity where the error occurred.=(identitywheretheerroroccurred. = (value)) ⇒ Object



318
# File 'lib/sus/assertions.rb', line 318

attr :identity