Exception: Test::Unit::AssertionFailedError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/test/unit/assertion-failed-error.rb

Overview

Thrown by Test::Unit::Assertions when an assertion fails.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, options = nil) ⇒ AssertionFailedError

Returns a new instance of AssertionFailedError.



25
26
27
28
29
30
31
32
33
34
# File 'lib/test/unit/assertion-failed-error.rb', line 25

def initialize(message=nil, options=nil)
  options ||= {}
  @expected = options[:expected]
  @actual = options[:actual]
  @inspected_expected = options[:inspected_expected]
  @inspected_actual = options[:inspected_actual]
  @user_message = options[:user_message]
  super(message)
  debug_on_failure
end

Instance Attribute Details

#actualObject

Returns the value of attribute actual.



23
24
25
# File 'lib/test/unit/assertion-failed-error.rb', line 23

def actual
  @actual
end

#expectedObject

Returns the value of attribute expected.



23
24
25
# File 'lib/test/unit/assertion-failed-error.rb', line 23

def expected
  @expected
end

#inspected_actualObject

Returns the value of attribute inspected_actual.



24
25
26
# File 'lib/test/unit/assertion-failed-error.rb', line 24

def inspected_actual
  @inspected_actual
end

#inspected_expectedObject

Returns the value of attribute inspected_expected.



24
25
26
# File 'lib/test/unit/assertion-failed-error.rb', line 24

def inspected_expected
  @inspected_expected
end

#user_messageObject

Returns the value of attribute user_message.



23
24
25
# File 'lib/test/unit/assertion-failed-error.rb', line 23

def user_message
  @user_message
end

Class Method Details

.debug_on_failure=(boolean) ⇒ Object



14
15
16
# File 'lib/test/unit/assertion-failed-error.rb', line 14

def debug_on_failure=(boolean)
  @debug_on_failure = boolean
end

.debug_on_failure?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/test/unit/assertion-failed-error.rb', line 18

def debug_on_failure?
  @debug_on_failure
end