Class: RLab::Assert::AssertionFailed
Instance Attribute Summary collapse
-
#assertion ⇒ Object
readonly
Returns the value of attribute assertion.
Instance Method Summary collapse
- #backtrace ⇒ Object
-
#initialize(assertion) ⇒ AssertionFailed
constructor
A new instance of AssertionFailed.
- #to_s ⇒ Object
Constructor Details
#initialize(assertion) ⇒ AssertionFailed
Returns a new instance of AssertionFailed.
8 9 10 |
# File 'lib/rlab/assert/errors.rb', line 8 def initialize assertion @assertion = assertion end |
Instance Attribute Details
#assertion ⇒ Object (readonly)
Returns the value of attribute assertion.
6 7 8 |
# File 'lib/rlab/assert/errors.rb', line 6 def assertion @assertion end |
Instance Method Details
#backtrace ⇒ Object
12 13 14 |
# File 'lib/rlab/assert/errors.rb', line 12 def backtrace assertion.trace.map &:to_s end |
#to_s ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rlab/assert/errors.rb', line 16 def to_s failures = assertion.fails.map do |failed_check| failed_check. end if failures.size > 1 "Assertion failure:\n\n * #{failures * "\n * "}\n" else "Assertion failure: #{failures * ", "}" end end |