Exception: Test::Unit::AssertionFailedError
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
StandardError
|
|
Instance Chain:
self,
StandardError
|
|
Inherits: |
StandardError
|
Defined in: | lib/test/unit/assertion-failed-error.rb |
Overview
Thrown by Assertions
when an assertion fails.
Class Attribute Summary
Class Method Summary
Instance Attribute Summary
- #actual rw
- #expected rw
- #inspected_actual rw
- #inspected_expected rw
- #user_message rw
Instance Method Summary
- #debug_on_failure private
Constructor Details
.new(message = nil, options = nil) ⇒ AssertionFailedError
# File 'lib/test/unit/assertion-failed-error.rb', line 25
def initialize(=nil, =nil) ||= {} @expected = [:expected] @actual = [:actual] @inspected_expected = [:inspected_expected] @inspected_actual = [:inspected_actual] @user_message = [: ] super( ) debug_on_failure end
Class Attribute Details
.debug_on_failure=(boolean) (rw)
[ GitHub ]# File 'lib/test/unit/assertion-failed-error.rb', line 14
def debug_on_failure=(boolean) @debug_on_failure = boolean end
.debug_on_failure? ⇒ Boolean
(rw)
[ GitHub ]
# File 'lib/test/unit/assertion-failed-error.rb', line 18
def debug_on_failure? @debug_on_failure end
Instance Attribute Details
#actual (rw)
[ GitHub ]# File 'lib/test/unit/assertion-failed-error.rb', line 23
attr_accessor :expected, :actual, :
#expected (rw)
[ GitHub ]# File 'lib/test/unit/assertion-failed-error.rb', line 23
attr_accessor :expected, :actual, :
#inspected_actual (rw)
[ GitHub ]# File 'lib/test/unit/assertion-failed-error.rb', line 24
attr_accessor :inspected_expected, :inspected_actual
#inspected_expected (rw)
[ GitHub ]# File 'lib/test/unit/assertion-failed-error.rb', line 24
attr_accessor :inspected_expected, :inspected_actual
#user_message (rw)
[ GitHub ]Instance Method Details
#debug_on_failure (private)
[ GitHub ]# File 'lib/test/unit/assertion-failed-error.rb', line 37
def debug_on_failure return unless self.class.debug_on_failure? begin require "debug" rescue LoadError return end return unless binding.respond_to?(:break) frames = caller(0) pre = nil Util::BacktraceFilter.filter_backtrace(frames).each do |location| frame_index = frames.index(location) next if frame_index.nil? pre = "frame #{frame_index}" break end binding.break(pre: pre) end