Sha256: 872dc0542625878e7f6a7c2fbd6ebc848d06370d985aaaab7a3539c20fd66601

Contents?: true

Size: 1.14 KB

Versions: 8

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

module RSpec
  # Send log messages to the console.
  #
  # @api private
  module Console
    # @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

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

    # 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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
r_spec-1.0.1 lib/r_spec/console.rb
r_spec-1.0.0 lib/r_spec/console.rb
r_spec-1.0.0.beta11 lib/r_spec/console.rb
r_spec-1.0.0.beta10 lib/r_spec/console.rb
r_spec-1.0.0.beta9 lib/r_spec/console.rb
r_spec-1.0.0.beta8 lib/r_spec/console.rb
r_spec-1.0.0.beta7 lib/r_spec/console.rb
r_spec-1.0.0.beta6 lib/r_spec/console.rb