Sha256: 50188b3f458af0cf3a7d09bff3c7b3f55c5032fc82d310b72eb9ef9b1e9c0357

Contents?: true

Size: 805 Bytes

Versions: 1

Compression:

Stored size: 805 Bytes

Contents

require_relative 'base'

module Spectus
  module Result
    # The class that is responsible for reporting that the expectation is true.
    class Pass
      include Base

      # @!attribute [r] message
      #
      # @return [String] The message that describe the state.
      attr_reader :message

      # The value of the expectation of the spec.
      #
      # @return [Boolean] The spec was true.
      def result?
        true
      end

      # Identify the state of the result.
      #
      # @param color [Boolean] Enable the color.
      #
      # @return [String] The char that identify the state of the result.
      def to_char(color = false)
        if got
          color ? "\e[32m.\e[0m" : '.'
        else
          color ? "\e[33mI\e[0m" : 'I'
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spectus-2.6.0 lib/spectus/result/pass.rb