Sha256: 370577dcce0cd5c09d2a39c3a50b219fb7097714e8108b4f3f0ab94645a46439

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

module RSpec
  module Clone
    # Send log messages to the console.
    module Logger
      # @param report [::Expresenter::Pass] Passed expectation result presenter.
      #
      # @see https://github.com/fixrb/expresenter
      #
      # @return [nil] Add a colored message to `$stdout`.
      def self.passed_spec(report)
        puts report.colored_string
      end

      # :nocov:

      # @param report [::Expresenter::Fail] Failed expectation result presenter.
      #
      # @see https://github.com/fixrb/expresenter
      #
      # @raise [SystemExit] Terminate execution immediately with message.
      def self.failed_spec(report)
        abort report.colored_string
      end

      # :nocov:

      # The Ruby source filename and line number containing this method or nil
      # if this method was not defined in Ruby (i.e. native).
      #
      # @param filename [String, nil] The Ruby source filename.
      # @param line     [Integer, nil] The Ruby source line number.
      #
      # @return [String] The Ruby source filename and line number associated with
      #   the evaluated spec.
      def self.source(filename, line)
        puts [filename, line].compact.join(":")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
r_spec-clone-1.7.1 lib/r_spec/clone/logger.rb
r_spec-clone-1.7.0 lib/r_spec/clone/logger.rb