class Rspec::PendingFor::Build

SRP: Describe the RubyEngine and/or RubyVersion(s) that will be pended or skipped and with what message

Constants

BROKEN_STRING
BUG_STRING
INTERPRETER_MATRIX

Keys are the

RELEVANT_VERSIONS_PROC
VERSIONS_STRING

Attributes

message[R]
reason[R]
relevant_engine[R]
relevant_versions[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/rspec/pending_for/build.rb, line 41
def initialize(options = {})
  @relevant_versions = Array(options[:versions]) # cast to array
  @relevant_engine = options[:engine].nil? ? nil : options[:engine].to_s
  @reason = options[:reason]
  warn_about_unrecognized_engine
  # If engine is nil, then any matching versions should be pended
  @message = if @relevant_engine.nil?
               no_engine_specified
             elsif RubyEngine.is? @relevant_engine
               engine_specified_and_relevant
             end
end

Public Instance Methods

current_matches_specified?() click to toggle source
# File lib/rspec/pending_for/build.rb, line 54
def current_matches_specified?
  !message.nil?
end

Private Instance Methods

engine_specified_and_relevant() click to toggle source
# File lib/rspec/pending_for/build.rb, line 73
def engine_specified_and_relevant
  if relevant_versions.empty?
    # No versions specified means ALL versions for this engine
    reason || "#{BROKEN_STRING} #{BUG_STRING} #{INTERPRETER_MATRIX[relevant_engine]}"
  elsif relevant_versions.include?(RubyVersion.to_s)
    reason || %[#{RELEVANT_VERSIONS_PROC.call(relevant_versions)} (#{INTERPRETER_MATRIX[relevant_engine]})]
  end
end
no_engine_specified() click to toggle source
# File lib/rspec/pending_for/build.rb, line 69
def no_engine_specified
  reason || RELEVANT_VERSIONS_PROC.call(relevant_versions) if relevant_versions.include?(RubyVersion.to_s)
end
warn_about_unrecognized_engine() click to toggle source
# File lib/rspec/pending_for/build.rb, line 60
      def warn_about_unrecognized_engine
        return false if relevant_engine.nil? || !INTERPRETER_MATRIX[relevant_engine].nil?

        warn %[
Engine specified (#{relevant_engine}) is not known to rspec-pending_for.
If it is a real RUBY_ENGINE, please report as a bug to #{ISSUES_LINK}
]
      end