Exception: RubyUnit::AssertionFailure
- Inherits:
-
StandardError
- Object
- StandardError
- RubyUnit::AssertionFailure
- Includes:
- AssertionMessage
- Defined in:
- lib/RubyUnit/AssertionFailure.rb
Overview
Exception that is raised when a test assertion fails.
Constant Summary
Constants included from AssertionMessage
RubyUnit::AssertionMessage::ASSERT_CLASS_METHOD_ERROR, RubyUnit::AssertionMessage::ASSERT_CONST_DEFINED_ERROR, RubyUnit::AssertionMessage::ASSERT_CONST_ERROR, RubyUnit::AssertionMessage::ASSERT_CONST_NOT_DEFINED_ERROR, RubyUnit::AssertionMessage::ASSERT_DESCENDENT_ERROR, RubyUnit::AssertionMessage::ASSERT_EMPTY_ERROR, RubyUnit::AssertionMessage::ASSERT_EQUAL_ERROR, RubyUnit::AssertionMessage::ASSERT_ERROR, RubyUnit::AssertionMessage::ASSERT_FALSE_ERROR, RubyUnit::AssertionMessage::ASSERT_GREATERTHANOREQUAL_ERROR, RubyUnit::AssertionMessage::ASSERT_GREATERTHAN_ERROR, RubyUnit::AssertionMessage::ASSERT_INCLUDE_ERROR, RubyUnit::AssertionMessage::ASSERT_INSTANCE_METHOD_ERROR, RubyUnit::AssertionMessage::ASSERT_INSTANCE_OF_ERROR, RubyUnit::AssertionMessage::ASSERT_INSTANCE_VARIABLE_DEFINED_ERROR, RubyUnit::AssertionMessage::ASSERT_INSTANCE_VARIABLE_EQUAL_ERROR, RubyUnit::AssertionMessage::ASSERT_INSTANCE_VARIABLE_KIND_OF_ERROR, RubyUnit::AssertionMessage::ASSERT_INSTANCE_VARIABLE_NOT_DEFINED_ERROR, RubyUnit::AssertionMessage::ASSERT_INSTANCE_VARIABLE_NOT_EQUAL_ERROR, RubyUnit::AssertionMessage::ASSERT_INSTANCE_VARIABLE_NOT_KIND_OF_ERROR, RubyUnit::AssertionMessage::ASSERT_KIND_OF_ERROR, RubyUnit::AssertionMessage::ASSERT_LESSTHANOREQUAL_ERROR, RubyUnit::AssertionMessage::ASSERT_LESSTHAN_ERROR, RubyUnit::AssertionMessage::ASSERT_MATCH_ERROR, RubyUnit::AssertionMessage::ASSERT_METHOD_ERROR, RubyUnit::AssertionMessage::ASSERT_NIL_ERROR, RubyUnit::AssertionMessage::ASSERT_NOTHING_RAISED_ERROR, RubyUnit::AssertionMessage::ASSERT_NOT_CLASS_METHOD_ERROR, RubyUnit::AssertionMessage::ASSERT_NOT_DESCENDENT_ERROR, RubyUnit::AssertionMessage::ASSERT_NOT_EMPTY_ERROR, RubyUnit::AssertionMessage::ASSERT_NOT_EQUAL_ERROR, RubyUnit::AssertionMessage::ASSERT_NOT_ERROR, RubyUnit::AssertionMessage::ASSERT_NOT_INCLUDE_ERROR, RubyUnit::AssertionMessage::ASSERT_NOT_INSTANCE_METHOD_ERROR, RubyUnit::AssertionMessage::ASSERT_NOT_INSTANCE_OF_ERROR, RubyUnit::AssertionMessage::ASSERT_NOT_KIND_OF_ERROR, RubyUnit::AssertionMessage::ASSERT_NOT_MATCH_ERROR, RubyUnit::AssertionMessage::ASSERT_NOT_METHOD_ERROR, RubyUnit::AssertionMessage::ASSERT_NOT_NIL_ERROR, RubyUnit::AssertionMessage::ASSERT_NOT_RESPOND_TO_ERROR, RubyUnit::AssertionMessage::ASSERT_NOT_SAME_ERROR, RubyUnit::AssertionMessage::ASSERT_RAISE_ERROR, RubyUnit::AssertionMessage::ASSERT_RAISE_EXPECTED_ERROR, RubyUnit::AssertionMessage::ASSERT_RAISE_KIND_OF_ERROR, RubyUnit::AssertionMessage::ASSERT_RAISE_MESSAGE_ERROR, RubyUnit::AssertionMessage::ASSERT_RESPOND_TO_ERROR, RubyUnit::AssertionMessage::ASSERT_SAME_ERROR, RubyUnit::AssertionMessage::ASSERT_TRUE_ERROR, RubyUnit::AssertionMessage::FAILING, RubyUnit::AssertionMessage::FAILURE
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#info ⇒ Object
Create a string from the assertion data.
-
#initialize(data = {}) ⇒ AssertionFailure
constructor
Create a RubyUnit::AssertionFailure exception.
Constructor Details
#initialize(data = {}) ⇒ AssertionFailure
Create a RubyUnit::AssertionFailure exception
- data
-
The data associated with the assertion
17 18 19 20 |
# 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 |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
9 10 11 |
# File 'lib/RubyUnit/AssertionFailure.rb', line 9 def data @data end |
Instance Method Details
#info ⇒ Object
Create a string from the assertion data
25 26 27 28 29 30 31 32 |
# File 'lib/RubyUnit/AssertionFailure.rb', line 25 def info data = [] data << if .length > 0 @data.each do |key, value| data << ":#{key} => #{value.inspect}" end data.join "\n" end |