class RubyUnit::AssertionFailure

Exception that is raised when a test assertion fails.

Attributes

data[R]

Public Class Methods

new(data = {}) click to toggle source

Create a RubyUnit::AssertionFailure exception

data

The data associated with the assertion

# File lib/RubyUnit/AssertionFailure.rb, line 17
def initialize data = {}
  raise TypeError, 'Data for AssertionFailure must be a Hash' unless data.is_a? Hash
  @data = data
end

Public Instance Methods

info() click to toggle source

Create a string from the assertion data

# File lib/RubyUnit/AssertionFailure.rb, line 25
def info
  data = []
  data << message if message.length > 0
  @data.each do |key, value|
    data << ":#{key} => #{value.inspect}"
  end
  data.join "\n"
end