Sha256: ae04e37a56a1a8a598d210ca38258375ab60be5143b5e721764aaa9c8952ed29
Contents?: true
Size: 1.1 KB
Versions: 14
Compression:
Stored size: 1.1 KB
Contents
require_relative 'base' module Spectus module Result # The class that is responsible for reporting that the expectation is false. class Fail < StandardError include Base # The value of the expectation of the spec. # # @return [Boolean] The spec was false. def result? false end # The state of failure. # # @return [Boolean] The test was a failure. def failure? error.nil? end # The state of error. # # @return [Boolean] The test was an error. def error? !failure? end # Identify the state of the result. # # @return [Symbol] The identifier of the state. def to_sym failure? ? :failure : :error end # Express the result with one char. # # @param color [Boolean] Enable the color. # # @return [String] The char that identify the result. def to_char(color = false) if failure? color ? "\e[35mF\e[0m" : 'F' else color ? "\e[31mE\e[0m" : 'E' end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems