Class: Sus::Assertions::Assert

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identity, backtrace, assertions) ⇒ Assert

Returns a new instance of Assert.



163
164
165
166
167
# File 'lib/sus/assertions.rb', line 163

def initialize(identity, backtrace, assertions)
	@identity = identity
	@backtrace = backtrace
	@assertions = assertions
end

Instance Attribute Details

#assertionsObject (readonly)

Returns the value of attribute assertions.



171
172
173
# File 'lib/sus/assertions.rb', line 171

def assertions
  @assertions
end

#backtraceObject (readonly)

Returns the value of attribute backtrace.



170
171
172
# File 'lib/sus/assertions.rb', line 170

def backtrace
  @backtrace
end

#identityObject (readonly)

Returns the value of attribute identity.



169
170
171
# File 'lib/sus/assertions.rb', line 169

def identity
  @identity
end

Instance Method Details

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

Yields:

  • (_self)

Yield Parameters:



173
174
175
# File 'lib/sus/assertions.rb', line 173

def each_failure(&block)
	yield self
end

#messageObject



177
178
179
180
181
182
183
# File 'lib/sus/assertions.rb', line 177

def message
	{
		# It's possible that several Assert instances might share the same output text. This is because the output is buffered for each test and each top-level test expectation.
		text: @assertions.output.string,
		location: @identity&.to_location
	}
end